All example code now properly references Twython instead of Tango - this should've been done months ago, can't believe it slipped my mind. Sorry for anyone who was totally confused by this. ;P
This commit is contained in:
parent
46c93f4adb
commit
024742d51b
12 changed files with 38 additions and 27 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import tango
|
import twitter
|
||||||
|
|
||||||
""" Instantiate Tango with no Authentication """
|
""" Instantiate Twython with no Authentication """
|
||||||
twitter = tango.setup()
|
twitter = twitter.setup()
|
||||||
trends = twitter.getCurrentTrends()
|
trends = twitter.getCurrentTrends()
|
||||||
|
|
||||||
print trends
|
print trends
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import tango
|
import twitter
|
||||||
|
|
||||||
""" Instantiate Tango with no Authentication """
|
""" Instantiate Twython with no Authentication """
|
||||||
twitter = tango.setup()
|
twitter = twitter.setup()
|
||||||
trends = twitter.getDailyTrends()
|
trends = twitter.getDailyTrends()
|
||||||
|
|
||||||
print trends
|
print trends
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import tango, pprint
|
import twython, pprint
|
||||||
|
|
||||||
# Authenticate using Basic (HTTP) Authentication
|
# Authenticate using Basic (HTTP) Authentication
|
||||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
twitter = twython.setup(authtype="Basic", username="example", password="example")
|
||||||
friends_timeline = twitter.getFriendsTimeline(count="150", page="3")
|
friends_timeline = twitter.getFriendsTimeline(count="150", page="3")
|
||||||
|
|
||||||
for tweet in friends_timeline:
|
for tweet in friends_timeline:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import tango
|
import twitter
|
||||||
|
|
||||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
twitter = twitter.setup(authtype="Basic", username="example", password="example")
|
||||||
mentions = twitter.getUserMentions(count="150")
|
mentions = twitter.getUserMentions(count="150")
|
||||||
|
|
||||||
print mentions
|
print mentions
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import tango
|
import twython
|
||||||
|
|
||||||
# We won't authenticate for this, but sometimes it's necessary
|
# We won't authenticate for this, but sometimes it's necessary
|
||||||
twitter = tango.setup()
|
twitter = twython.setup()
|
||||||
user_timeline = twitter.getUserTimeline(screen_name="ryanmcgrath")
|
user_timeline = twitter.getUserTimeline(screen_name="ryanmcgrath")
|
||||||
|
|
||||||
print user_timeline
|
print user_timeline
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import tango
|
import twython
|
||||||
|
|
||||||
# Getting the public timeline requires no authentication, huzzah
|
# Getting the public timeline requires no authentication, huzzah
|
||||||
twitter = tango.setup()
|
twitter = twython.setup()
|
||||||
public_timeline = twitter.getPublicTimeline()
|
public_timeline = twitter.getPublicTimeline()
|
||||||
|
|
||||||
for tweet in public_timeline:
|
for tweet in public_timeline:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import tango
|
import twython
|
||||||
|
|
||||||
# Instantiate with Basic (HTTP) Authentication
|
# Instantiate with Basic (HTTP) Authentication
|
||||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
twitter = twython.setup(authtype="Basic", username="example", password="example")
|
||||||
|
|
||||||
# This returns the rate limit for the requesting IP
|
# This returns the rate limit for the requesting IP
|
||||||
rateLimit = twitter.getRateLimitStatus()
|
rateLimit = twitter.getRateLimitStatus()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import tango
|
import twython
|
||||||
|
|
||||||
""" Instantiate Tango with no Authentication """
|
""" Instantiate Tango with no Authentication """
|
||||||
twitter = tango.setup()
|
twitter = twython.setup()
|
||||||
search_results = twitter.searchTwitter("WebsDotCom", rpp="50")
|
search_results = twitter.searchTwitter("WebsDotCom", rpp="50")
|
||||||
|
|
||||||
for tweet in search_results["results"]:
|
for tweet in search_results["results"]:
|
||||||
|
|
|
||||||
11
examples/twython_setup.py
Normal file
11
examples/twython_setup.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
import twython
|
||||||
|
|
||||||
|
# Using no authentication and specifying Debug
|
||||||
|
twitter = twython.setup(debug=True)
|
||||||
|
|
||||||
|
# Using Basic Authentication
|
||||||
|
twitter = twython.setup(authtype="Basic", username="example", password="example")
|
||||||
|
|
||||||
|
# Using OAuth Authentication (Note: OAuth is the default, specify Basic if needed)
|
||||||
|
auth_keys = {"consumer_key": "yourconsumerkey", "consumer_secret": "yourconsumersecret"}
|
||||||
|
twitter = twython.setup(username="example", password="example", oauth_keys=auth_keys)
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import tango
|
import twython
|
||||||
|
|
||||||
# Instantiate Tango with Basic (HTTP) Authentication
|
# Instantiate Twython with Basic (HTTP) Authentication
|
||||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
twitter = twython.setup(authtype="Basic", username="example", password="example")
|
||||||
twitter.updateProfileImage("myImage.png")
|
twitter.updateProfileImage("myImage.png")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import tango
|
import twython
|
||||||
|
|
||||||
# Create a Tango instance using Basic (HTTP) Authentication and update our Status
|
# Create a Twython instance using Basic (HTTP) Authentication and update our Status
|
||||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
twitter = twython.setup(authtype="Basic", username="example", password="example")
|
||||||
twitter.updateStatus("See how easy this was?")
|
twitter.updateStatus("See how easy this was?")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import tango
|
import twython
|
||||||
|
|
||||||
""" Instantiate Tango with no Authentication """
|
""" Instantiate Twython with no Authentication """
|
||||||
twitter = tango.setup()
|
twitter = twython.setup()
|
||||||
trends = twitter.getWeeklyTrends()
|
trends = twitter.getWeeklyTrends()
|
||||||
|
|
||||||
print trends
|
print trends
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue