Update Examples and LICENSE

Some examples were out of date (any trends example)
Renamed the core_examples dir. to examples
This commit is contained in:
Mike Helmick 2013-04-18 22:21:32 -04:00
parent bb019d3a57
commit 4ac6436901
14 changed files with 44 additions and 67 deletions

View file

@ -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

View file

@ -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"

6
examples/shorten_url.py Normal file
View file

@ -0,0 +1,6 @@
from twython import Twython
# Shortening URLs requires no authentication, huzzah
shortURL = Twython.shortenURL('http://www.webs.com/')
print shortURL

View file

@ -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')

View file

@ -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