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:
parent
bb019d3a57
commit
4ac6436901
14 changed files with 44 additions and 67 deletions
10
examples/get_user_timeline.py
Normal file
10
examples/get_user_timeline.py
Normal 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
|
||||
12
examples/search_results.py
Normal file
12
examples/search_results.py
Normal 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
6
examples/shorten_url.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from twython import Twython
|
||||
|
||||
# Shortening URLs requires no authentication, huzzah
|
||||
shortURL = Twython.shortenURL('http://www.webs.com/')
|
||||
|
||||
print shortURL
|
||||
5
examples/update_profile_image.py
Normal file
5
examples/update_profile_image.py
Normal 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')
|
||||
9
examples/update_status.py
Normal file
9
examples/update_status.py
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue