Documentation showcasing proper importing; kinda sorta needed.
This commit is contained in:
parent
068c504030
commit
8ea61af4fc
2 changed files with 25 additions and 5 deletions
12
README.md
12
README.md
|
|
@ -34,6 +34,8 @@ Usage
|
|||
Authorization URL
|
||||
|
||||
```python
|
||||
from twython import Twython
|
||||
|
||||
t = Twython(app_key=app_key,
|
||||
app_secret=app_secret,
|
||||
callback_url='http://google.com/')
|
||||
|
|
@ -51,6 +53,8 @@ Be sure you have a URL set up to handle the callback after the user has allowed
|
|||
Handling the callback
|
||||
|
||||
```python
|
||||
from twython import Twython
|
||||
|
||||
'''
|
||||
oauth_token and oauth_token_secret come from the previous step
|
||||
if needed, store those in a session variable or something
|
||||
|
|
@ -70,6 +74,8 @@ print auth_tokens
|
|||
Getting a user home timeline
|
||||
|
||||
```python
|
||||
from twython import Twython
|
||||
|
||||
'''
|
||||
oauth_token and oauth_token_secret are the final tokens produced
|
||||
from the `Handling the callback` step
|
||||
|
|
@ -87,6 +93,8 @@ print t.getHomeTimeline()
|
|||
Get a user avatar url *(no authentication needed)*
|
||||
|
||||
```python
|
||||
from twython import Twython
|
||||
|
||||
t = Twython()
|
||||
print t.getProfileImageUrl('ryanmcgrath', size='bigger')
|
||||
print t.getProfileImageUrl('mikehelmick')
|
||||
|
|
@ -95,6 +103,8 @@ print t.getProfileImageUrl('mikehelmick')
|
|||
Search Twitter *(no authentication needed)*
|
||||
|
||||
```python
|
||||
from twython import Twython
|
||||
|
||||
t = Twython()
|
||||
print t.search(q='python')
|
||||
```
|
||||
|
|
@ -104,6 +114,8 @@ Streaming API
|
|||
streams.*
|
||||
|
||||
```python
|
||||
from twython import Twython
|
||||
|
||||
def on_results(results):
|
||||
"""A callback to handle passed results. Wheeee.
|
||||
"""
|
||||
|
|
|
|||
18
README.rst
18
README.rst
|
|
@ -37,7 +37,8 @@ Usage
|
|||
Authorization URL
|
||||
~~~~~~~~~~~~~~~~~
|
||||
::
|
||||
|
||||
from twython import Twython
|
||||
|
||||
t = Twython(app_key=app_key,
|
||||
app_secret=app_secret,
|
||||
callback_url='http://google.com/')
|
||||
|
|
@ -59,6 +60,7 @@ Handling the callback
|
|||
oauth_token and oauth_token_secret come from the previous step
|
||||
if needed, store those in a session variable or something
|
||||
'''
|
||||
from twython import Twython
|
||||
|
||||
t = Twython(app_key=app_key,
|
||||
app_secret=app_secret,
|
||||
|
|
@ -78,19 +80,22 @@ Getting a user home timeline
|
|||
oauth_token and oauth_token_secret are the final tokens produced
|
||||
from the `Handling the callback` step
|
||||
'''
|
||||
|
||||
from twython import Twython
|
||||
|
||||
t = Twython(app_key=app_key,
|
||||
app_secret=app_secret,
|
||||
oauth_token=oauth_token,
|
||||
oauth_token_secret=oauth_token_secret)
|
||||
|
||||
|
||||
# Returns an dict of the user home timeline
|
||||
print t.getHomeTimeline()
|
||||
|
||||
Get a user avatar url *(no authentication needed)*
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
::
|
||||
|
||||
|
||||
from twython import Twython
|
||||
|
||||
t = Twython()
|
||||
print t.getProfileImageUrl('ryanmcgrath', size='bigger')
|
||||
print t.getProfileImageUrl('mikehelmick')
|
||||
|
|
@ -98,7 +103,8 @@ Get a user avatar url *(no authentication needed)*
|
|||
Search Twitter *(no authentication needed)*
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
::
|
||||
|
||||
|
||||
from twython import Twython
|
||||
t = Twython()
|
||||
print t.search(q='python')
|
||||
|
||||
|
|
@ -109,6 +115,8 @@ streams.*
|
|||
|
||||
::
|
||||
|
||||
from twython import Twython
|
||||
|
||||
def on_results(results):
|
||||
"""A callback to handle passed results. Wheeee.
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue