Documentation showcasing proper importing; kinda sorta needed.

This commit is contained in:
Ryan McGrath 2012-06-25 05:08:16 +09:00
parent 068c504030
commit 8ea61af4fc
2 changed files with 25 additions and 5 deletions

View file

@ -34,6 +34,8 @@ Usage
Authorization URL Authorization URL
```python ```python
from twython import Twython
t = Twython(app_key=app_key, t = Twython(app_key=app_key,
app_secret=app_secret, app_secret=app_secret,
callback_url='http://google.com/') 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 Handling the callback
```python ```python
from twython import Twython
''' '''
oauth_token and oauth_token_secret come from the previous step oauth_token and oauth_token_secret come from the previous step
if needed, store those in a session variable or something if needed, store those in a session variable or something
@ -70,6 +74,8 @@ print auth_tokens
Getting a user home timeline Getting a user home timeline
```python ```python
from twython import Twython
''' '''
oauth_token and oauth_token_secret are the final tokens produced oauth_token and oauth_token_secret are the final tokens produced
from the `Handling the callback` step from the `Handling the callback` step
@ -87,6 +93,8 @@ print t.getHomeTimeline()
Get a user avatar url *(no authentication needed)* Get a user avatar url *(no authentication needed)*
```python ```python
from twython import Twython
t = Twython() t = Twython()
print t.getProfileImageUrl('ryanmcgrath', size='bigger') print t.getProfileImageUrl('ryanmcgrath', size='bigger')
print t.getProfileImageUrl('mikehelmick') print t.getProfileImageUrl('mikehelmick')
@ -95,6 +103,8 @@ print t.getProfileImageUrl('mikehelmick')
Search Twitter *(no authentication needed)* Search Twitter *(no authentication needed)*
```python ```python
from twython import Twython
t = Twython() t = Twython()
print t.search(q='python') print t.search(q='python')
``` ```
@ -104,6 +114,8 @@ Streaming API
streams.* streams.*
```python ```python
from twython import Twython
def on_results(results): def on_results(results):
"""A callback to handle passed results. Wheeee. """A callback to handle passed results. Wheeee.
""" """

View file

@ -37,6 +37,7 @@ Usage
Authorization URL Authorization URL
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
:: ::
from twython import Twython
t = Twython(app_key=app_key, t = Twython(app_key=app_key,
app_secret=app_secret, app_secret=app_secret,
@ -59,6 +60,7 @@ Handling the callback
oauth_token and oauth_token_secret come from the previous step oauth_token and oauth_token_secret come from the previous step
if needed, store those in a session variable or something if needed, store those in a session variable or something
''' '''
from twython import Twython
t = Twython(app_key=app_key, t = Twython(app_key=app_key,
app_secret=app_secret, app_secret=app_secret,
@ -78,6 +80,7 @@ Getting a user home timeline
oauth_token and oauth_token_secret are the final tokens produced oauth_token and oauth_token_secret are the final tokens produced
from the `Handling the callback` step from the `Handling the callback` step
''' '''
from twython import Twython
t = Twython(app_key=app_key, t = Twython(app_key=app_key,
app_secret=app_secret, app_secret=app_secret,
@ -91,6 +94,8 @@ Get a user avatar url *(no authentication needed)*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: ::
from twython import Twython
t = Twython() t = Twython()
print t.getProfileImageUrl('ryanmcgrath', size='bigger') print t.getProfileImageUrl('ryanmcgrath', size='bigger')
print t.getProfileImageUrl('mikehelmick') print t.getProfileImageUrl('mikehelmick')
@ -99,6 +104,7 @@ Search Twitter *(no authentication needed)*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: ::
from twython import Twython
t = Twython() t = Twython()
print t.search(q='python') print t.search(q='python')
@ -109,6 +115,8 @@ streams.*
:: ::
from twython import Twython
def on_results(results): def on_results(results):
"""A callback to handle passed results. Wheeee. """A callback to handle passed results. Wheeee.
""" """