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 """
|
||||
twitter = tango.setup()
|
||||
""" Instantiate Twython with no Authentication """
|
||||
twitter = twitter.setup()
|
||||
trends = twitter.getCurrentTrends()
|
||||
|
||||
print trends
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import tango
|
||||
import twitter
|
||||
|
||||
""" Instantiate Tango with no Authentication """
|
||||
twitter = tango.setup()
|
||||
""" Instantiate Twython with no Authentication """
|
||||
twitter = twitter.setup()
|
||||
trends = twitter.getDailyTrends()
|
||||
|
||||
print trends
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import tango, pprint
|
||||
import twython, pprint
|
||||
|
||||
# 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")
|
||||
|
||||
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")
|
||||
|
||||
print mentions
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import tango
|
||||
import twython
|
||||
|
||||
# We won't authenticate for this, but sometimes it's necessary
|
||||
twitter = tango.setup()
|
||||
twitter = twython.setup()
|
||||
user_timeline = twitter.getUserTimeline(screen_name="ryanmcgrath")
|
||||
|
||||
print user_timeline
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import tango
|
||||
import twython
|
||||
|
||||
# Getting the public timeline requires no authentication, huzzah
|
||||
twitter = tango.setup()
|
||||
twitter = twython.setup()
|
||||
public_timeline = twitter.getPublicTimeline()
|
||||
|
||||
for tweet in public_timeline:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import tango
|
||||
import twython
|
||||
|
||||
# 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
|
||||
rateLimit = twitter.getRateLimitStatus()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import tango
|
||||
import twython
|
||||
|
||||
""" Instantiate Tango with no Authentication """
|
||||
twitter = tango.setup()
|
||||
twitter = twython.setup()
|
||||
search_results = twitter.searchTwitter("WebsDotCom", rpp="50")
|
||||
|
||||
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
|
||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
||||
# Instantiate Twython with Basic (HTTP) Authentication
|
||||
twitter = twython.setup(authtype="Basic", username="example", password="example")
|
||||
twitter.updateProfileImage("myImage.png")
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import tango
|
||||
import twython
|
||||
|
||||
# Create a Tango instance using Basic (HTTP) Authentication and update our Status
|
||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
||||
# Create a Twython instance using Basic (HTTP) Authentication and update our Status
|
||||
twitter = twython.setup(authtype="Basic", username="example", password="example")
|
||||
twitter.updateStatus("See how easy this was?")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import tango
|
||||
import twython
|
||||
|
||||
""" Instantiate Tango with no Authentication """
|
||||
twitter = tango.setup()
|
||||
""" Instantiate Twython with no Authentication """
|
||||
twitter = twython.setup()
|
||||
trends = twitter.getWeeklyTrends()
|
||||
|
||||
print trends
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue