Permalink
Please sign in to comment.
Browse files
Update Examples and LICENSE
Some examples were out of date (any trends example) Renamed the core_examples dir. to examples
- Loading branch information...
Showing
with
44 additions
and 67 deletions.
- +1 −1 LICENSE
- +6 −5 README.md
- +0 −7 core_examples/current_trends.py
- +0 −7 core_examples/daily_trends.py
- +0 −7 core_examples/get_user_timeline.py
- +0 −9 core_examples/search_results.py
- +0 −9 core_examples/update_profile_image.py
- +0 −14 core_examples/update_status.py
- +0 −7 core_examples/weekly_trends.py
- +10 −0 examples/get_user_timeline.py
- +12 −0 examples/search_results.py
- +1 −1 {core_examples → examples}/shorten_url.py
- +5 −0 examples/update_profile_image.py
- +9 −0 examples/update_status.py
| @@ -1,7 +0,0 @@ | ||
| -from twython import Twython | ||
| - | ||
| -""" Instantiate Twython with no Authentication """ | ||
| -twitter = Twython() | ||
| -trends = twitter.getCurrentTrends() | ||
| - | ||
| -print trends |
| @@ -1,7 +0,0 @@ | ||
| -from twython import Twython | ||
| - | ||
| -""" Instantiate Twython with no Authentication """ | ||
| -twitter = Twython() | ||
| -trends = twitter.getDailyTrends() | ||
| - | ||
| -print trends |
| @@ -1,7 +0,0 @@ | ||
| -from twython import Twython | ||
| - | ||
| -# We won't authenticate for this, but sometimes it's necessary | ||
| -twitter = Twython() | ||
| -user_timeline = twitter.getUserTimeline(screen_name="ryanmcgrath") | ||
| - | ||
| -print user_timeline |
| @@ -1,9 +0,0 @@ | ||
| -from twython import Twython | ||
| - | ||
| -""" Instantiate Twython with no Authentication """ | ||
| -twitter = Twython() | ||
| -search_results = twitter.search(q="WebsDotCom", rpp="50") | ||
| - | ||
| -for tweet in search_results["results"]: | ||
| - print "Tweet from @%s Date: %s" % (tweet['from_user'].encode('utf-8'),tweet['created_at']) | ||
| - print tweet['text'].encode('utf-8'),"\n" |
| @@ -1,9 +0,0 @@ | ||
| -from twython import Twython | ||
| - | ||
| -""" | ||
| - You'll need to go through the OAuth ritual to be able to successfully | ||
| - use this function. See the example oauth django application included in | ||
| - this package for more information. | ||
| -""" | ||
| -twitter = Twython() | ||
| -twitter.updateProfileImage("myImage.png") |
| @@ -1,14 +0,0 @@ | ||
| -from twython import Twython | ||
| - | ||
| -""" | ||
| - Note: for any method that'll require you to be authenticated (updating | ||
| - things, etc) | ||
| - you'll need to go through the OAuth authentication ritual. See the example | ||
| - Django application that's included with this package for more information. | ||
| -""" | ||
| -twitter = Twython() | ||
| - | ||
| -# OAuth ritual... | ||
| - | ||
| - | ||
| -twitter.updateStatus(status="See how easy this was?") |
| @@ -1,7 +0,0 @@ | ||
| -from twython import Twython | ||
| - | ||
| -""" Instantiate Twython with no Authentication """ | ||
| -twitter = Twython() | ||
| -trends = twitter.getWeeklyTrends() | ||
| - | ||
| -print trends |
| @@ -0,0 +1,10 @@ | ||
| +from twython import Twython, TwythonError | ||
| + | ||
| +# Requires Authentication as of Twitter API v1.1 | ||
| +twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) | ||
| +try: | ||
| + user_timeline = twitter.getUserTimeline(screen_name='ryanmcgrath') | ||
| +except TwythonError as e: | ||
| + print e | ||
| + | ||
| +print user_timeline |
| @@ -0,0 +1,12 @@ | ||
| +from twython import Twython, TwythonError | ||
| + | ||
| +# Requires Authentication as of Twitter API v1.1 | ||
| +twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) | ||
| +try: | ||
| + search_results = twitter.search(q="WebsDotCom", rpp="50") | ||
| +except TwythonError as e: | ||
| + print e | ||
| + | ||
| +for tweet in search_results["results"]: | ||
| + print "Tweet from @%s Date: %s" % (tweet['from_user'].encode('utf-8'),tweet['created_at']) | ||
| + print tweet['text'].encode('utf-8'),"\n" |
| @@ -1,6 +1,6 @@ | ||
| from twython import Twython | ||
| # Shortening URLs requires no authentication, huzzah | ||
| -shortURL = Twython.shortenURL("http://www.webs.com/") | ||
| +shortURL = Twython.shortenURL('http://www.webs.com/') | ||
| print shortURL |
| @@ -0,0 +1,5 @@ | ||
| +from twython import Twython | ||
| + | ||
| +# Requires Authentication as of Twitter API v1.1 | ||
| +twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) | ||
| +twitter.updateProfileImage('myImage.png') |
| @@ -0,0 +1,9 @@ | ||
| +from twython import Twython, TwythonError | ||
| + | ||
| +# Requires Authentication as of Twitter API v1.1 | ||
| +twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) | ||
| + | ||
| +try: | ||
| + twitter.updateStatus(status='See how easy this was?') | ||
| +except TwythonError as e: | ||
| + print e |
0 comments on commit
4ac6436