Reorganizing into a more package based structure, setting an initial (not working) setup.py file - this will be expanded soon
This commit is contained in:
parent
4fed1e241f
commit
d7d170cc3b
16 changed files with 1357 additions and 0 deletions
7
examples/current_trends.py
Normal file
7
examples/current_trends.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import tango
|
||||
|
||||
""" Instantiate Tango with no Authentication """
|
||||
twitter = tango.setup()
|
||||
trends = twitter.getCurrentTrends()
|
||||
|
||||
print trends
|
||||
7
examples/daily_trends.py
Normal file
7
examples/daily_trends.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import tango
|
||||
|
||||
""" Instantiate Tango with no Authentication """
|
||||
twitter = tango.setup()
|
||||
trends = twitter.getDailyTrends()
|
||||
|
||||
print trends
|
||||
8
examples/get_friends_timeline.py
Normal file
8
examples/get_friends_timeline.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import tango, pprint
|
||||
|
||||
# Authenticate using Basic (HTTP) Authentication
|
||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
||||
friends_timeline = twitter.getFriendsTimeline(count="150", page="3")
|
||||
|
||||
for tweet in friends_timeline:
|
||||
print tweet["text"]
|
||||
6
examples/get_user_mention.py
Normal file
6
examples/get_user_mention.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import tango
|
||||
|
||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
||||
mentions = twitter.getUserMentions(count="150")
|
||||
|
||||
print mentions
|
||||
7
examples/get_user_timeline.py
Normal file
7
examples/get_user_timeline.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import tango
|
||||
|
||||
# We won't authenticate for this, but sometimes it's necessary
|
||||
twitter = tango.setup()
|
||||
user_timeline = twitter.getUserTimeline(screen_name="ryanmcgrath")
|
||||
|
||||
print user_timeline
|
||||
8
examples/public_timeline.py
Normal file
8
examples/public_timeline.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import tango
|
||||
|
||||
# Getting the public timeline requires no authentication, huzzah
|
||||
twitter = tango.setup()
|
||||
public_timeline = twitter.getPublicTimeline()
|
||||
|
||||
for tweet in public_timeline:
|
||||
print tweet["text"]
|
||||
10
examples/rate_limit.py
Normal file
10
examples/rate_limit.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import tango
|
||||
|
||||
# Instantiate with Basic (HTTP) Authentication
|
||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
||||
|
||||
# This returns the rate limit for the requesting IP
|
||||
rateLimit = twitter.getRateLimitStatus()
|
||||
|
||||
# This returns the rate limit for the requesting authenticated user
|
||||
rateLimit = twitter.getRateLimitStatus(rate_for="user")
|
||||
8
examples/search_results.py
Normal file
8
examples/search_results.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import tango
|
||||
|
||||
""" Instantiate Tango with no Authentication """
|
||||
twitter = tango.setup()
|
||||
search_results = twitter.searchTwitter("WebsDotCom", rpp="50")
|
||||
|
||||
for tweet in search_results["results"]:
|
||||
print tweet["text"]
|
||||
7
examples/shorten_url.py
Normal file
7
examples/shorten_url.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import tango
|
||||
|
||||
# Shortening URLs requires no authentication, huzzah
|
||||
twitter = tango.setup()
|
||||
shortURL = twitter.shortenURL("http://www.webs.com/")
|
||||
|
||||
print shortURL
|
||||
11
examples/tango_setup.py
Normal file
11
examples/tango_setup.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import tango
|
||||
|
||||
# Using no authentication and specifying Debug
|
||||
twitter = tango.setup(debug=True)
|
||||
|
||||
# Using Basic Authentication
|
||||
twitter = tango.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 = tango.setup(username="example", password="example", oauth_keys=auth_keys)
|
||||
5
examples/update_profile_image.py
Normal file
5
examples/update_profile_image.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import tango
|
||||
|
||||
# Instantiate Tango with Basic (HTTP) Authentication
|
||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
||||
twitter.updateProfileImage("myImage.png")
|
||||
5
examples/update_status.py
Normal file
5
examples/update_status.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import tango
|
||||
|
||||
# Create a Tango instance using Basic (HTTP) Authentication and update our Status
|
||||
twitter = tango.setup(authtype="Basic", username="example", password="example")
|
||||
twitter.updateStatus("See how easy this was?")
|
||||
7
examples/weekly_trends.py
Normal file
7
examples/weekly_trends.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import tango
|
||||
|
||||
""" Instantiate Tango with no Authentication """
|
||||
twitter = tango.setup()
|
||||
trends = twitter.getWeeklyTrends()
|
||||
|
||||
print trends
|
||||
Loading…
Add table
Add a link
Reference in a new issue