Merged chbrown's patch to use 1.1 for default versioning endpoints; bumped to 2.5.1
This commit is contained in:
commit
b6c5dc5a48
2 changed files with 8 additions and 8 deletions
2
setup.py
2
setup.py
|
|
@ -4,7 +4,7 @@ from setuptools import setup
|
||||||
from setuptools import find_packages
|
from setuptools import find_packages
|
||||||
|
|
||||||
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
|
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
|
||||||
__version__ = '2.5.0'
|
__version__ = '2.5.1'
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
# Basic package information.
|
# Basic package information.
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ class Twython(object):
|
||||||
we haven't gotten around to putting it in Twython yet. :)
|
we haven't gotten around to putting it in Twython yet. :)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def request(self, endpoint, method='GET', params=None, files=None, version=1):
|
def request(self, endpoint, method='GET', params=None, files=None, version='1.1'):
|
||||||
# In case they want to pass a full Twitter URL
|
# In case they want to pass a full Twitter URL
|
||||||
# i.e. https://search.twitter.com/
|
# i.e. https://search.twitter.com/
|
||||||
if endpoint.startswith('http://') or endpoint.startswith('https://'):
|
if endpoint.startswith('http://') or endpoint.startswith('https://'):
|
||||||
|
|
@ -239,10 +239,10 @@ class Twython(object):
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def get(self, endpoint, params=None, version=1):
|
def get(self, endpoint, params=None, version='1.1'):
|
||||||
return self.request(endpoint, params=params, version=version)
|
return self.request(endpoint, params=params, version=version)
|
||||||
|
|
||||||
def post(self, endpoint, params=None, files=None, version=1):
|
def post(self, endpoint, params=None, files=None, version='1.1'):
|
||||||
return self.request(endpoint, 'POST', params=params, files=files, version=version)
|
return self.request(endpoint, 'POST', params=params, files=files, version=version)
|
||||||
|
|
||||||
# End Dynamic Request Methods
|
# End Dynamic Request Methods
|
||||||
|
|
@ -369,7 +369,7 @@ class Twython(object):
|
||||||
e.g x.search(q='jjndf', page='2')
|
e.g x.search(q='jjndf', page='2')
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return self.get('https://search.twitter.com/search.json', params=kwargs)
|
return self.get('https://api.twitter.com/1.1/search/tweets.json', params=kwargs)
|
||||||
|
|
||||||
def searchGen(self, search_query, **kwargs):
|
def searchGen(self, search_query, **kwargs):
|
||||||
""" Returns a generator of tweets that match a specified query.
|
""" Returns a generator of tweets that match a specified query.
|
||||||
|
|
@ -383,7 +383,7 @@ class Twython(object):
|
||||||
print result
|
print result
|
||||||
"""
|
"""
|
||||||
kwargs['q'] = search_query
|
kwargs['q'] = search_query
|
||||||
content = self.get('https://search.twitter.com/search.json', params=kwargs)
|
content = self.get('https://api.twitter.com/1.1/search/tweets.json', params=kwargs)
|
||||||
|
|
||||||
if not content['results']:
|
if not content['results']:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
|
|
@ -448,7 +448,7 @@ class Twython(object):
|
||||||
return self._media_update(url,
|
return self._media_update(url,
|
||||||
{'image': (file_, open(file_, 'rb'))})
|
{'image': (file_, open(file_, 'rb'))})
|
||||||
|
|
||||||
def updateStatusWithMedia(self, file_, version=1, **params):
|
def updateStatusWithMedia(self, file_, version='1.1', **params):
|
||||||
"""Updates the users status with media
|
"""Updates the users status with media
|
||||||
|
|
||||||
:param file_: (required) A string to the location of the file
|
:param file_: (required) A string to the location of the file
|
||||||
|
|
@ -480,7 +480,7 @@ class Twython(object):
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
def getProfileImageUrl(self, username, size='normal', version=1):
|
def getProfileImageUrl(self, username, size='normal', version='1.1'):
|
||||||
"""Gets the URL for the user's profile image.
|
"""Gets the URL for the user's profile image.
|
||||||
|
|
||||||
:param username: (required) Username, self explanatory.
|
:param username: (required) Username, self explanatory.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue