forked from csu/pyquora
-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
118 lines (82 loc) · 2.66 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
pyquora
=======
Note: parts of this library may be broken due to changes on Quora's end. Issues and pull requests welcome.
----------------------------------------------------------------------------------------------------------
|Build Status|
A Python module to fetch and parse data from Quora.
Table of Contents
-----------------
- `Installation <#installation>`__
- `Usage <#usage>`__
- `Features <#features>`__
- `Contribute <#contribute>`__
- `Projects using ``pyquora`` <#projects-using-pyquora>`__
Installation
------------
You will need `Python 2 <https://www.python.org/download/>`__.
`pip <http://pip.readthedocs.org/en/latest/installing.html>`__ is
recommended for installing dependencies.
Install using pip:
::
pip install quora
Usage
-----
User statistics
~~~~~~~~~~~~~~~
.. code:: python
from quora import User
user = User('Christopher-J-Su')
# Get user activity
activity = user.activity
# Do stuff with the parsed activity data
print activity
# Get user statistics
stats = user.stats
# Take a gander
print stats
Questions
~~~~~~~~~
.. code:: python
from quora import Quora
# Get question statistics
question = Quora.get_question_stats('what-is-python')
# question is:
# {
# 'want_answers': 3,
# 'question_text': u'What is python?',
# 'topics': [u'Science, Engineering, and Technology', u'Technology', u'Electronics', u'Computers'],
# 'question_details': None, 'answer_count': 1,
# 'answer_wiki': '<div class="hidden" id="answer_wiki"><div id="ld_mqcfmt_15628"><div id="__w2_po3p1uM_wiki"></div></div></div>',
# }
Answer statistics
~~~~~~~~~~~~~~~~~
.. code:: python
from quora import Quora
# The function can be called in any of the following ways.
answer = Quora.get_one_answer('http://qr.ae/6hARL')
answer = Quora.get_one_answer('6hARL')
answer = Quora.get_one_answer(question, author) # question and answer are variables
# answer is:
# {
# 'want_answers': 8,
# 'views': 197,
# 'author': u'Mayur-P-R-Rohith',
# 'question_link': u'https://www.quora.com/Does-Quora-similar-question-search-when-posing-a-new-question-work-better-than-the-search-box-ove',
# 'comment_count': 1,
# 'answer': '...',
# 'upvote_count': 5
# }
# Get the latest answers from a question
latest_answers = Quora.get_latest_answers('what-is-python')
Features
--------
Currently implemented
~~~~~~~~~~~~~~~~~~~~~
- User statistics
- User activity
- Question statistics
- Answer statistics
To do
~~~~~
- Detailed user information (followers, following, etc.; not just
statistics)