diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..996a1e1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.pyc +build +dist +twython.egg-info diff --git a/__init__.py b/__init__.py deleted file mode 100644 index 73b19e2..0000000 --- a/__init__.py +++ /dev/null @@ -1 +0,0 @@ -import twython as twython diff --git a/examples/current_trends.py b/examples/current_trends.py index 425cdee..8ee4d74 100644 --- a/examples/current_trends.py +++ b/examples/current_trends.py @@ -1,4 +1,4 @@ -import twitter +import twython.core as twython """ Instantiate Twython with no Authentication """ twitter = twython.setup() diff --git a/examples/daily_trends.py b/examples/daily_trends.py index 987611e..38ca507 100644 --- a/examples/daily_trends.py +++ b/examples/daily_trends.py @@ -1,4 +1,4 @@ -import twitter +import twython.core as twython """ Instantiate Twython with no Authentication """ twitter = twython.setup() diff --git a/examples/get_friends_timeline.py b/examples/get_friends_timeline.py index 9f3fa06..9e67583 100644 --- a/examples/get_friends_timeline.py +++ b/examples/get_friends_timeline.py @@ -1,7 +1,7 @@ -import twython, pprint +import twython.core as twython, pprint # Authenticate using Basic (HTTP) Authentication -twitter = twython.setup(authtype="Basic", username="example", password="example") +twitter = twython.setup(username="example", password="example") friends_timeline = twitter.getFriendsTimeline(count="150", page="3") for tweet in friends_timeline: diff --git a/examples/get_user_mention.py b/examples/get_user_mention.py index 08b3dff..0db63a0 100644 --- a/examples/get_user_mention.py +++ b/examples/get_user_mention.py @@ -1,6 +1,6 @@ -import twitter +import twython.core as twython -twitter = twython.setup(authtype="Basic", username="example", password="example") +twitter = twython.setup(username="example", password="example") mentions = twitter.getUserMentions(count="150") print mentions diff --git a/examples/get_user_timeline.py b/examples/get_user_timeline.py index b4191b0..bdb9200 100644 --- a/examples/get_user_timeline.py +++ b/examples/get_user_timeline.py @@ -1,4 +1,4 @@ -import twython +import twython.core as twython # We won't authenticate for this, but sometimes it's necessary twitter = twython.setup() diff --git a/examples/public_timeline.py b/examples/public_timeline.py index b6be0f7..4670037 100644 --- a/examples/public_timeline.py +++ b/examples/public_timeline.py @@ -1,4 +1,4 @@ -import twython +import twython.core as twython # Getting the public timeline requires no authentication, huzzah twitter = twython.setup() diff --git a/examples/rate_limit.py b/examples/rate_limit.py index aca5095..4b632b0 100644 --- a/examples/rate_limit.py +++ b/examples/rate_limit.py @@ -1,7 +1,7 @@ -import twython +import twython.core as twython # Instantiate with Basic (HTTP) Authentication -twitter = twython.setup(authtype="Basic", username="example", password="example") +twitter = twython.setup(username="example", password="example") # This returns the rate limit for the requesting IP rateLimit = twitter.getRateLimitStatus() diff --git a/examples/search_results.py b/examples/search_results.py index b046b22..e0df48b 100644 --- a/examples/search_results.py +++ b/examples/search_results.py @@ -1,4 +1,4 @@ -import twython +import twython.core as twython """ Instantiate Tango with no Authentication """ twitter = twython.setup() diff --git a/examples/shorten_url.py b/examples/shorten_url.py index 2a744d6..f0824bf 100644 --- a/examples/shorten_url.py +++ b/examples/shorten_url.py @@ -1,4 +1,4 @@ -import twython +import twython as twython # Shortening URLs requires no authentication, huzzah twitter = twython.setup() diff --git a/examples/twython_setup.py b/examples/twython_setup.py index 362cb43..6eea228 100644 --- a/examples/twython_setup.py +++ b/examples/twython_setup.py @@ -1,11 +1,7 @@ -import twython +import twython.core as twython -# Using no authentication and specifying Debug -twitter = twython.setup(debug=True) +# Using no authentication +twitter = twython.setup() -# 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) +# Using Basic Authentication (core is all about basic auth, look to twython.oauth in the future for oauth) +twitter = twython.setup(username="example", password="example") diff --git a/examples/update_profile_image.py b/examples/update_profile_image.py index ad6f9ad..37ee00e 100644 --- a/examples/update_profile_image.py +++ b/examples/update_profile_image.py @@ -1,5 +1,5 @@ -import twython +import twython.core as twython # Instantiate Twython with Basic (HTTP) Authentication -twitter = twython.setup(authtype="Basic", username="example", password="example") +twitter = twython.setup(username="example", password="example") twitter.updateProfileImage("myImage.png") diff --git a/examples/update_status.py b/examples/update_status.py index 52d2e87..0f7fe38 100644 --- a/examples/update_status.py +++ b/examples/update_status.py @@ -1,5 +1,5 @@ -import twython +import twython.core as twython # Create a Twython instance using Basic (HTTP) Authentication and update our Status -twitter = twython.setup(authtype="Basic", username="example", password="example") +twitter = twython.setup(username="example", password="example") twitter.updateStatus("See how easy this was?") diff --git a/examples/weekly_trends.py b/examples/weekly_trends.py index 5871fbd..e48fb95 100644 --- a/examples/weekly_trends.py +++ b/examples/weekly_trends.py @@ -1,4 +1,4 @@ -import twython +import twython.core as twython """ Instantiate Twython with no Authentication """ twitter = twython.setup() diff --git a/setup.py b/setup.py index f5c956f..1a52d20 100644 --- a/setup.py +++ b/setup.py @@ -3,9 +3,7 @@ import sys, os __author__ = 'Ryan McGrath ' -__version__ = '0.9' - -# For the love of god, use Pip to install this. +__version__ = '1.0' # Distutils version METADATA = dict( diff --git a/twython/__init__.py b/twython/__init__.py new file mode 100644 index 0000000..083a571 --- /dev/null +++ b/twython/__init__.py @@ -0,0 +1 @@ +import core, oauth, streaming diff --git a/core/twython.py b/twython/core.py similarity index 99% rename from core/twython.py rename to twython/core.py index f9e94bd..b88d637 100644 --- a/core/twython.py +++ b/twython/core.py @@ -16,7 +16,7 @@ from urlparse import urlparse from urllib2 import HTTPError __author__ = "Ryan McGrath " -__version__ = "0.9" +__version__ = "1.0" """Twython - Easy Twitter utilities in Python""" diff --git a/oauth/twython_oauth.py b/twython/oauth/__init__.py similarity index 97% rename from oauth/twython_oauth.py rename to twython/oauth/__init__.py index db9ed1d..4d88b1f 100644 --- a/oauth/twython_oauth.py +++ b/twython/oauth/__init__.py @@ -7,17 +7,17 @@ Questions, comments? ryan@venodesigns.net """ -import twython, httplib, urllib, urllib2, mimetypes, mimetools +import httplib, urllib, urllib2, mimetypes, mimetools from urlparse import urlparse from urllib2 import HTTPError try: - import oauth + import oauth as oauthlib except ImportError: pass -class twyauth: +class oauth: def __init__(self, username, consumer_key, consumer_secret, signature_method = None, headers = None, version = 1): """oauth(username = None, consumer_secret = None, consumer_key = None, headers = None) diff --git a/twython/oauth/__init__.pyc b/twython/oauth/__init__.pyc new file mode 100644 index 0000000..3b8a498 Binary files /dev/null and b/twython/oauth/__init__.pyc differ diff --git a/oauth/oauth.py b/twython/oauth/oauth.py similarity index 100% rename from oauth/oauth.py rename to twython/oauth/oauth.py diff --git a/twython/oauth/oauth.pyc b/twython/oauth/oauth.pyc new file mode 100644 index 0000000..cef4c6e Binary files /dev/null and b/twython/oauth/oauth.pyc differ diff --git a/streaming/twython_streaming.py b/twython/streaming/__init__.py similarity index 96% rename from streaming/twython_streaming.py rename to twython/streaming/__init__.py index b681145..f6df1a3 100644 --- a/streaming/twython_streaming.py +++ b/twython/streaming/__init__.py @@ -1,6 +1,8 @@ #!/usr/bin/python """ + Yes, this is just in __init__ for now, hush. + The beginnings of Twitter Streaming API support in Twython. Don't expect this to work at all, consider it a stub for now. -- Ryan diff --git a/twython/streaming/__init__.pyc b/twython/streaming/__init__.pyc new file mode 100644 index 0000000..f1c6bf7 Binary files /dev/null and b/twython/streaming/__init__.pyc differ diff --git a/twython3k/__init__.py b/twython3k/__init__.py new file mode 100644 index 0000000..d93c168 --- /dev/null +++ b/twython3k/__init__.py @@ -0,0 +1 @@ +import core diff --git a/core/twython3k.py b/twython3k/core.py similarity index 100% rename from core/twython3k.py rename to twython3k/core.py