Updated AUTHORS, HISTORY; added ssl_verify; removed _media_update
- Added @jvanasco to the AUTHORS.rst - Updated History - Removed _media_update internal function - Twython now takes ssl_verify param
This commit is contained in:
parent
a451db43c1
commit
776e02b071
4 changed files with 30 additions and 23 deletions
|
|
@ -38,3 +38,4 @@ Patches and Suggestions
|
|||
- `Virendra Rajput <https://github.com/bkvirendra>`_, Fixed unicode (json) encoding in twython.py 2.7.2.
|
||||
- `Paul Solbach <https://github.com/hansenrum>`_, fixed requirement for oauth_verifier
|
||||
- `Greg Nofi <https://github.com/nofeet>`_, fixed using built-in Exception attributes for storing & retrieving error message
|
||||
- `Jonathan Vanasco <https://github.com/jvanasco>`_, Debugging support, error_code tracking, Twitter error API tracking, other fixes
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
History
|
||||
-------
|
||||
|
||||
2.8.0 (2013-xx-xx)
|
||||
2.8.0 (2013-04-29)
|
||||
++++++++++++++++++
|
||||
|
||||
- Added a ``HISTORY.rst`` to start tracking history of changes
|
||||
|
|
@ -25,6 +25,8 @@ just define it
|
|||
- Removed `bulkUserLookup` (please use `lookupUser` instead), removed `getProfileImageUrl` (will be completely removed from Twitter API on May 7th, 2013)
|
||||
- Updated shortenUrl to actually work for those using it, but it is being deprecated since `requests` makes it easy for developers to implement their own url shortening in their app (see https://github.com/ryanmcgrath/twython/issues/184)
|
||||
- Twython Deprecation Warnings will now be seen in shell when using Python 2.7 and greater
|
||||
- Twython now takes ``ssl_verify`` parameter, defaults True. Set False if you're having development server issues
|
||||
- Removed internal ``_media_update`` function, we could have always just used ``self.post``
|
||||
|
||||
2.7.3 (2013-04-12)
|
||||
++++++++++++++++++
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -25,7 +25,7 @@ setup(
|
|||
include_package_data=True,
|
||||
|
||||
# Package dependencies.
|
||||
install_requires=['requests>=1.0.0, <2.0.0', 'requests_oauthlib==0.3.0'],
|
||||
install_requires=['requests==1.2.0', 'requests_oauthlib==0.3.0'],
|
||||
|
||||
# Metadata for PyPI.
|
||||
author='Ryan McGrath',
|
||||
|
|
|
|||
|
|
@ -14,8 +14,10 @@ warnings.simplefilter('always', TwythonDeprecationWarning) # For Python 2.7 >
|
|||
|
||||
|
||||
class Twython(object):
|
||||
def __init__(self, app_key=None, app_secret=None, oauth_token=None, oauth_token_secret=None,
|
||||
headers=None, proxies=None, version='1.1', callback_url=None, twitter_token=None, twitter_secret=None):
|
||||
def __init__(self, app_key=None, app_secret=None, oauth_token=None,
|
||||
oauth_token_secret=None, headers=None, proxies=None,
|
||||
version='1.1', callback_url=None, ssl_verify=True,
|
||||
twitter_token=None, twitter_secret=None):
|
||||
"""Instantiates an instance of Twython. Takes optional parameters for authentication and such (see below).
|
||||
|
||||
:param app_key: (optional) Your applications key
|
||||
|
|
@ -25,6 +27,7 @@ class Twython(object):
|
|||
:param headers: (optional) Custom headers to send along with the request
|
||||
:param callback_url: (optional) If set, will overwrite the callback url set in your application
|
||||
:param proxies: (optional) A dictionary of proxies, for example {"http":"proxy.example.org:8080", "https":"proxy.example.org:8081"}.
|
||||
:param ssl_verify: (optional) Turns off ssl verification when False. Useful if you have development server issues.
|
||||
"""
|
||||
|
||||
# API urls, OAuth urls and API version; needed for hitting that there API.
|
||||
|
|
@ -76,6 +79,7 @@ class Twython(object):
|
|||
self.client.headers = self.headers
|
||||
self.client.proxies = proxies
|
||||
self.client.auth = self.auth
|
||||
self.client.verify = ssl_verify
|
||||
|
||||
# register available funcs to allow listing name when debugging.
|
||||
def setFunc(key):
|
||||
|
|
@ -334,9 +338,6 @@ class Twython(object):
|
|||
|
||||
## Media Uploading functions ##############################################
|
||||
|
||||
def _media_update(self, url, file_, **params):
|
||||
return self.post(url, params=params, files=file_)
|
||||
|
||||
def updateProfileBackgroundImage(self, file_, version='1.1', **params):
|
||||
"""Updates the authenticating user's profile background image.
|
||||
|
||||
|
|
@ -348,10 +349,11 @@ class Twython(object):
|
|||
**params - You may pass items that are stated in this doc
|
||||
(https://dev.twitter.com/docs/api/1.1/post/account/update_profile_background_image)
|
||||
"""
|
||||
url = 'https://api.twitter.com/%s/account/update_profile_background_image.json' % version
|
||||
return self._media_update(url,
|
||||
{'image': (file_, open(file_, 'rb'))},
|
||||
**params)
|
||||
|
||||
return self.post('account/update_profile_background_image',
|
||||
params=params,
|
||||
files={'image': (file_, open(file_, 'rb'))},
|
||||
version=version)
|
||||
|
||||
def updateProfileImage(self, file_, version='1.1', **params):
|
||||
"""Updates the authenticating user's profile image (avatar).
|
||||
|
|
@ -363,10 +365,11 @@ class Twython(object):
|
|||
**params - You may pass items that are stated in this doc
|
||||
(https://dev.twitter.com/docs/api/1.1/post/account/update_profile_image)
|
||||
"""
|
||||
url = 'https://api.twitter.com/%s/account/update_profile_image.json' % version
|
||||
return self._media_update(url,
|
||||
{'image': (file_, open(file_, 'rb'))},
|
||||
**params)
|
||||
|
||||
return self.post('account/update_profile_image',
|
||||
params=params,
|
||||
files={'image': (file_, open(file_, 'rb'))},
|
||||
version=version)
|
||||
|
||||
def updateStatusWithMedia(self, file_, version='1.1', **params):
|
||||
"""Updates the users status with media
|
||||
|
|
@ -379,10 +382,10 @@ class Twython(object):
|
|||
(https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media)
|
||||
"""
|
||||
|
||||
url = 'https://api.twitter.com/%s/statuses/update_with_media.json' % version
|
||||
return self._media_update(url,
|
||||
{'media': (file_, open(file_, 'rb'))},
|
||||
**params)
|
||||
return self.post('statuses/update_with_media',
|
||||
params=params,
|
||||
files={'media': (file_, open(file_, 'rb'))},
|
||||
version=version)
|
||||
|
||||
def updateProfileBannerImage(self, file_, version='1.1', **params):
|
||||
"""Updates the users profile banner
|
||||
|
|
@ -394,10 +397,11 @@ class Twython(object):
|
|||
**params - You may pass items that are taken in this doc
|
||||
(https://dev.twitter.com/docs/api/1.1/post/account/update_profile_banner)
|
||||
"""
|
||||
url = 'https://api.twitter.com/%s/account/update_profile_banner.json' % version
|
||||
return self._media_update(url,
|
||||
{'banner': (file_, open(file_, 'rb'))},
|
||||
**params)
|
||||
|
||||
return self.post('account/update_profile_banner',
|
||||
params=params,
|
||||
files={'banner': (file_, open(file_, 'rb'))},
|
||||
version=version)
|
||||
|
||||
###########################################################################
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue