diff --git a/setup.py b/setup.py index aa9eb71..aa4d164 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python -import sys, os from setuptools import setup from setuptools import find_packages @@ -8,31 +7,31 @@ __author__ = 'Ryan McGrath ' __version__ = '1.4.6' setup( - # Basic package information. - name = 'twython', - version = __version__, - packages = find_packages(), + # Basic package information. + name='twython', + version=__version__, + packages=find_packages(), - # Packaging options. - include_package_data = True, + # Packaging options. + include_package_data=True, - # Package dependencies. - install_requires = ['simplejson', 'oauth2', 'httplib2', 'requests'], + # Package dependencies. + install_requires=['simplejson', 'oauth2', 'requests', 'requests-oauth'], - # Metadata for PyPI. - author = 'Ryan McGrath', - author_email = 'ryan@venodesigns.net', - license = 'MIT License', - url = 'http://github.com/ryanmcgrath/twython/tree/master', - keywords = 'twitter search api tweet twython', - description = 'An easy (and up to date) way to access Twitter data with Python.', - long_description = open('README.markdown').read(), - classifiers = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: Communications :: Chat', - 'Topic :: Internet' - ] + # Metadata for PyPI. + author='Ryan McGrath', + author_email='ryan@venodesigns.net', + license='MIT License', + url='http://github.com/ryanmcgrath/twython/tree/master', + keywords='twitter search api tweet twython', + description='An easy (and up to date) way to access Twitter data with Python.', + long_description=open('README.markdown').read(), + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Communications :: Chat', + 'Topic :: Internet' + ] ) diff --git a/twython/twython.py b/twython/twython.py index a2a125e..80ed8ea 100644 --- a/twython/twython.py +++ b/twython/twython.py @@ -12,7 +12,6 @@ __author__ = "Ryan McGrath " __version__ = "1.4.6" import urllib -import urllib2 import re import inspect import time @@ -31,7 +30,6 @@ except ImportError: # table is a file with a dictionary of every API endpoint that Twython supports. from twitter_endpoints import base_url, api_table -from urllib2 import HTTPError # There are some special setups (like, oh, a Django application) where # simplejson exists behind the scenes anyway. Past Python 2.6, this should @@ -272,22 +270,6 @@ class Twython(object): def constructApiURL(base_url, params): return base_url + "?" + "&".join(["%s=%s" % (Twython.unicode2utf8(key), urllib.quote_plus(Twython.unicode2utf8(value))) for (key, value) in params.iteritems()]) - @staticmethod - def shortenURL(url_to_shorten, shortener="http://is.gd/api.php", query="longurl"): - """shortenURL(url_to_shorten, shortener = "http://is.gd/api.php", query = "longurl") - - Shortens url specified by url_to_shorten. - - Parameters: - url_to_shorten - URL to shorten. - shortener - In case you want to use a url shortening service other than is.gd. - """ - try: - content = urllib2.urlopen(shortener + "?" + urllib.urlencode({query: Twython.unicode2utf8(url_to_shorten)})).read() - return content - except HTTPError, e: - raise TwythonError("shortenURL() failed with a %s error code." % e.code) - def bulkUserLookup(self, ids=None, screen_names=None, version=1, **kwargs): """ bulkUserLookup(self, ids = None, screen_names = None, version = 1, **kwargs)