Attempting to make docs clear and understandable
[ci skip]
This commit is contained in:
parent
8559a1f1ce
commit
44fb5b4a6e
7 changed files with 206 additions and 34 deletions
|
|
@ -7,23 +7,24 @@ This section will cover how to use Twython and interact with some basic Twitter
|
|||
|
||||
Before you make any API calls, make sure you :ref:`authenticated <starting-out>` the user!
|
||||
|
||||
.. note:: All sections on this page will assume you're using a Twython instance
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
Authenticated Calls
|
||||
-------------------
|
||||
|
||||
OAuth 1
|
||||
~~~~~~~
|
||||
|
||||
Create a Twython instance with your application keys and the users OAuth tokens::
|
||||
|
||||
from twython import Twython
|
||||
twitter = Twython(APP_KEY, APP_SECRET
|
||||
OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
|
||||
|
||||
.. admonition:: Important
|
||||
|
||||
All sections on this page will assume you're using a Twython instance
|
||||
|
||||
What Twython Returns
|
||||
--------------------
|
||||
|
||||
Twython returns a dictionary of JSON response from Twitter
|
||||
|
||||
User Information
|
||||
----------------
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
Documentation: https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ Documentation: https://dev.twitter.com/docs/api/1.1/get/account/verify_credentia
|
|||
twitter.verify_credentials()
|
||||
|
||||
Authenticated Users Home Timeline
|
||||
---------------------------------
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Documentation: https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline
|
||||
|
||||
|
|
@ -40,23 +41,10 @@ Documentation: https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline
|
|||
|
||||
twitter.get_home_timeline()
|
||||
|
||||
Search
|
||||
------
|
||||
|
||||
Documentation: https://dev.twitter.com/docs/api/1.1/get/search/tweets
|
||||
|
||||
::
|
||||
|
||||
twitter.search(q='python')
|
||||
|
||||
To help explain :ref:`dynamic function arguments <starting-out>` a little more, you can see that the previous call used the keyword argument ``q``, that is because Twitter specifies in their `search documentation <https://dev.twitter.com/docs/api/1.1/get/search/tweets>`_ that the search call accepts the parameter "q". You can pass mutiple keyword arguments. The search documentation also specifies that the call accepts the parameter "result_type"
|
||||
|
||||
::
|
||||
|
||||
twitter.search(q='python', result_type='popular')
|
||||
|
||||
Updating Status
|
||||
---------------
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
This method makes use of dynamic arguments, :ref:`read more about them <dynamicargexplaination>`
|
||||
|
||||
Documentation: https://dev.twitter.com/docs/api/1/post/statuses/update
|
||||
|
||||
|
|
@ -64,3 +52,33 @@ Documentation: https://dev.twitter.com/docs/api/1/post/statuses/update
|
|||
|
||||
twitter.update_status(status='See how easy using Twython is!')
|
||||
|
||||
|
||||
OAuth 2
|
||||
~~~~~~~
|
||||
|
||||
Create a Twython instance with your application key and access token::
|
||||
|
||||
from twython import Twython
|
||||
twitter = Twython(APP_KEY, access_token=ACCESS_TOKEN)
|
||||
|
||||
.. _howtosearch:
|
||||
|
||||
Searching
|
||||
---------
|
||||
|
||||
.. note:: Searching can be done whether you're authenticated via OAuth 1 or OAuth 2
|
||||
|
||||
Documentation: https://dev.twitter.com/docs/api/1.1/get/search/tweets
|
||||
|
||||
::
|
||||
|
||||
twitter.search(q='python')
|
||||
|
||||
.. _dynamicargexplaination:
|
||||
|
||||
.. important:: To help explain :ref:`dynamic function arguments <dynamicfunctionarguments>` a little more, you can see that the previous call used the keyword argument ``q``, that is because Twitter specifies in their `search documentation <https://dev.twitter.com/docs/api/1.1/get/search/tweets>`_ that the search call accepts the parameter "q". You can pass mutiple keyword arguments. The search documentation also specifies that the call accepts the parameter "result_type"
|
||||
|
||||
::
|
||||
|
||||
twitter.search(q='python', result_type='popular')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue