Updating docs
[ci skip]
This commit is contained in:
parent
8a1b55e343
commit
9f864a341c
6 changed files with 83 additions and 39 deletions
|
|
@ -5,7 +5,7 @@ Basic Usage
|
|||
|
||||
This section will cover how to use Twython and interact with some basic Twitter API calls
|
||||
|
||||
Before you make any API calls, make sure you :ref:`authenticated <starting-out>` the user!
|
||||
Before you make any API calls, make sure you :ref:`authenticated the user <oauth1>` (or :ref:`app <oauth2>`)!
|
||||
|
||||
.. note:: All sections on this page will assume you're using a Twython instance
|
||||
|
||||
|
|
@ -17,7 +17,9 @@ Authenticated Calls
|
|||
OAuth 1
|
||||
~~~~~~~
|
||||
|
||||
Create a Twython instance with your application keys and the users OAuth tokens::
|
||||
Create a Twython instance with your application keys and the users OAuth tokens
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from twython import Twython
|
||||
twitter = Twython(APP_KEY, APP_SECRET
|
||||
|
|
@ -28,7 +30,7 @@ User Information
|
|||
|
||||
Documentation: https://dev.twitter.com/docs/api/1.1/get/account/verify_credentials
|
||||
|
||||
::
|
||||
.. code-block:: python
|
||||
|
||||
twitter.verify_credentials()
|
||||
|
||||
|
|
@ -37,7 +39,7 @@ Authenticated Users Home Timeline
|
|||
|
||||
Documentation: https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline
|
||||
|
||||
::
|
||||
.. code-block:: python
|
||||
|
||||
twitter.get_home_timeline()
|
||||
|
||||
|
|
@ -48,7 +50,7 @@ This method makes use of dynamic arguments, :ref:`read more about them <dynamica
|
|||
|
||||
Documentation: https://dev.twitter.com/docs/api/1/post/statuses/update
|
||||
|
||||
::
|
||||
.. code-block:: python
|
||||
|
||||
twitter.update_status(status='See how easy using Twython is!')
|
||||
|
||||
|
|
@ -56,7 +58,9 @@ Documentation: https://dev.twitter.com/docs/api/1/post/statuses/update
|
|||
OAuth 2
|
||||
~~~~~~~
|
||||
|
||||
Create a Twython instance with your application key and access token::
|
||||
Create a Twython instance with your application key and access token
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from twython import Twython
|
||||
twitter = Twython(APP_KEY, access_token=ACCESS_TOKEN)
|
||||
|
|
@ -70,7 +74,7 @@ Searching
|
|||
|
||||
Documentation: https://dev.twitter.com/docs/api/1.1/get/search/tweets
|
||||
|
||||
::
|
||||
.. code-block:: python
|
||||
|
||||
twitter.search(q='python')
|
||||
|
||||
|
|
@ -78,7 +82,10 @@ Documentation: https://dev.twitter.com/docs/api/1.1/get/search/tweets
|
|||
|
||||
.. 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"
|
||||
|
||||
::
|
||||
.. code-block:: python
|
||||
|
||||
twitter.search(q='python', result_type='popular')
|
||||
|
||||
*******************************************************************************
|
||||
|
||||
So, now, you're pretty well versed on making authenticated calls to Twitter using Twython. Check out the :ref:`advanced usage <advanced-usage>` section, for some functions that may be a little more complicated.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue