commit
d63e6ce1c0
9 changed files with 56 additions and 18 deletions
13
AUTHORS.rst
13
AUTHORS.rst
|
|
@ -27,7 +27,7 @@ Patches and Suggestions
|
|||
- `Jonathan Elsas <https://github.com/jelsas>`_, Fix for original Streaming API stub causing import errors.
|
||||
- `LuqueDaniel <https://github.com/LuqueDaniel>`_, Extended example code where necessary.
|
||||
- `Mesar Hameed <https://github.com/mhameed>`_, Commit to swap ``__getattr__`` trick for a more debuggable solution.
|
||||
- `Remy DeCausemaker <https://github.com/decause>`_, PEP-8 contributions.
|
||||
- `Remy DeCausemaker <https://github.com/decause>`_, PEP 8 contributions.
|
||||
- `mckellister <https://github.com/mckellister>`_ Twitter Spring 2012 Clean Up fixes to ``Exception`` raised by Twython (Rate Limits, etc).
|
||||
- `Tatz Tsuchiya <http://d.hatena.ne.jp/tatz_tsuchiya/20120115/1326623451>`_, Fix for ``lambda`` scoping in key injection phase.
|
||||
- `Mohammed ALDOUB <https://github.com/Voulnet>`_, Fixes for ``http/https`` access endpoints.
|
||||
|
|
@ -43,3 +43,14 @@ Patches and Suggestions
|
|||
- `Ruben Varela Rosa <https://github.com/rubenvarela>`_, Fixed search example
|
||||
- `Oleg Anashkin <https://github.com/extesy>`_, streaming ``handlers`` functionality
|
||||
- `Luis Alberto Santana <https://github.com/jackboot7`_, Added auth_endpoint parameter for cases when the right permissions weren't being shown on authenticate step
|
||||
- `Cory Benfield <https://github.com/Lukasa>`_, Fixed issue where Twython was unnecessarily disabling compression
|
||||
- `Cory Dolphin <https://github.com/wcdolphin>`_, Added retry_after attribute to TwythonRateLimitError
|
||||
- `Natan L <https://github.com/kuyan>`_, Fixed typo in documentation
|
||||
- `Cash Costello <https://github.com/cash>`_, Moved tests to use `responsoes`, fixed typos in documentation
|
||||
- `Joe Cabrera <https://github.com/greedo>`_, PEP 8 contributions
|
||||
- `bsbkeven <https://github.com/bsbkeven>`_, Added `lookup_status` function to `endpoints.py`
|
||||
- `drevicko <https://github.com/drevicko>`_, Added option to yield full page vs individual results in `cursor`
|
||||
- `Filipe A Ximenes <https://github.com/filipeximenes>`_, Added `upload_media` function to `endpoints.py`
|
||||
- `Mertcan Mermerkaya <https://github.com/mmermerkaya>`_, Fixed code example in documentation
|
||||
- `Donne Martin <https://github.com/donnemartin>`_, Fixed typos in `README.rst`
|
||||
- `Diego Allen <https://github.com/dalleng>`_, Add missing comma in documentation code snippet
|
||||
|
|
|
|||
15
HISTORY.rst
15
HISTORY.rst
|
|
@ -3,6 +3,21 @@
|
|||
History
|
||||
-------
|
||||
|
||||
3.2.0 (2014-08-xx)
|
||||
++++++++++++++++++
|
||||
- PEP8'd some code
|
||||
- Added `lookup_status` function to `endpoints.py`
|
||||
- Added keyword argument to `cursor` to return full pages rather than individual results
|
||||
- `cursor` now uses while loop rather than recursion
|
||||
- Fixed issue where Twython was unnecessarily disabling compression
|
||||
- Using `responses` to mock API calls in tests
|
||||
- Fixed some typos in documentation
|
||||
- Added `retry_after` attribute to `TwythonRateLimitError`
|
||||
- Added `upload_media` method to `Twython` in favor of `update_with_media`
|
||||
- Deprecating `update_with_media` per Twitter API 1.1 (https://dev.twitter.com/rest/reference/post/statuses/update_with_media)
|
||||
- Unpin `requests` and `requests-oauthlib` in `requirements.txt`
|
||||
|
||||
|
||||
3.1.2 (2013-12-05)
|
||||
++++++++++++++++++
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,9 @@ copyright = u'2013, Ryan McGrath'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '3.1.2'
|
||||
version = '3.2.0'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '3.1.2'
|
||||
release = '3.2.0'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
coverage==3.6.0
|
||||
requests==2.1.0
|
||||
requests_oauthlib==0.4.0
|
||||
requests>=2.1.0
|
||||
requests_oauthlib>=0.4.0
|
||||
python-coveralls==2.1.0
|
||||
nose-cov==1.6
|
||||
responses==0.2.0
|
||||
responses==0.3.0
|
||||
|
|
|
|||
4
setup.py
4
setup.py
|
|
@ -9,7 +9,7 @@ except ImportError:
|
|||
from distutils.core import setup
|
||||
|
||||
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
|
||||
__version__ = '3.1.2'
|
||||
__version__ = '3.2.0'
|
||||
|
||||
packages = [
|
||||
'twython',
|
||||
|
|
@ -23,7 +23,7 @@ if sys.argv[-1] == 'publish':
|
|||
setup(
|
||||
name='twython',
|
||||
version=__version__,
|
||||
install_requires=['requests==2.1.0', 'requests_oauthlib==0.4.0'],
|
||||
install_requires=['requests>=2.1.0', 'requests_oauthlib>=0.4.0'],
|
||||
author='Ryan McGrath',
|
||||
author_email='ryan@venodesigns.net',
|
||||
license=open('LICENSE').read(),
|
||||
|
|
|
|||
|
|
@ -262,16 +262,16 @@ class TwythonAPITestCase(unittest.TestCase):
|
|||
"""Test getting last specific header of the last API call works"""
|
||||
endpoint = 'statuses/home_timeline'
|
||||
url = self.get_url(endpoint)
|
||||
self.register_response(responses.GET, url, adding_headers={'x-rate-limit-remaining': 37})
|
||||
self.register_response(responses.GET, url, adding_headers={'x-rate-limit-remaining': '37'})
|
||||
|
||||
self.api.get(endpoint)
|
||||
|
||||
value = self.api.get_lastfunction_header('x-rate-limit-remaining')
|
||||
self.assertEqual(37, value)
|
||||
self.assertEqual('37', value)
|
||||
value2 = self.api.get_lastfunction_header('does-not-exist')
|
||||
self.assertIsNone(value2)
|
||||
value3 = self.api.get_lastfunction_header('not-there-either', 96)
|
||||
self.assertEqual(96, value3)
|
||||
value3 = self.api.get_lastfunction_header('not-there-either', '96')
|
||||
self.assertEqual('96', value3)
|
||||
|
||||
def test_get_lastfunction_header_should_raise_error_when_no_previous_call(self):
|
||||
"""Test attempting to get a header when no API call was made raises a TwythonError"""
|
||||
|
|
@ -286,7 +286,7 @@ class TwythonAPITestCase(unittest.TestCase):
|
|||
|
||||
self.api.get(endpoint)
|
||||
|
||||
self.assertEqual(b'gzip, deflate, compress', responses.calls[0].request.headers['Accept-Encoding'])
|
||||
self.assertEqual(b'gzip, deflate', responses.calls[0].request.headers['Accept-Encoding'])
|
||||
|
||||
# Static methods
|
||||
def test_construct_api_url(self):
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Questions, comments? ryan@venodesigns.net
|
|||
"""
|
||||
|
||||
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
|
||||
__version__ = '3.1.2'
|
||||
__version__ = '3.2.0'
|
||||
|
||||
from .api import Twython
|
||||
from .streaming import TwythonStreamer
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ Twitter Authentication, and miscellaneous methods that are useful when
|
|||
dealing with the Twitter API
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
import requests
|
||||
from requests.auth import HTTPBasicAuth
|
||||
from requests_oauthlib import OAuth1, OAuth2
|
||||
|
|
@ -20,8 +22,6 @@ from .endpoints import EndpointsMixin
|
|||
from .exceptions import TwythonError, TwythonAuthError, TwythonRateLimitError
|
||||
from .helpers import _transparent_params
|
||||
|
||||
import warnings
|
||||
|
||||
warnings.simplefilter('always', TwythonDeprecationWarning) # For Python 2.7 >
|
||||
|
||||
|
||||
|
|
@ -243,9 +243,12 @@ class Twython(EndpointsMixin, object):
|
|||
:rtype: dict
|
||||
"""
|
||||
|
||||
if endpoint.startswith('http://'):
|
||||
raise TwythonError('api.twitter.com is restricted to SSL/TLS traffic.')
|
||||
|
||||
# In case they want to pass a full Twitter URL
|
||||
# i.e. https://api.twitter.com/1.1/search/tweets.json
|
||||
if endpoint.startswith('http://') or endpoint.startswith('https://'):
|
||||
if endpoint.startswith('https://'):
|
||||
url = endpoint
|
||||
else:
|
||||
url = '%s/%s.json' % (self.api_url % version, endpoint)
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@ This map is organized the order functions are documented at:
|
|||
https://dev.twitter.com/docs/api/1.1
|
||||
"""
|
||||
|
||||
import warnings
|
||||
|
||||
from .advisory import TwythonDeprecationWarning
|
||||
|
||||
|
||||
class EndpointsMixin(object):
|
||||
# Timelines
|
||||
|
|
@ -118,6 +122,11 @@ class EndpointsMixin(object):
|
|||
https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media
|
||||
|
||||
"""
|
||||
warnings.warn(
|
||||
'This method is deprecated. You should use Twython.upload_media instead.',
|
||||
TwythonDeprecationWarning,
|
||||
stacklevel=2
|
||||
)
|
||||
return self.post('statuses/update_with_media', params=params)
|
||||
|
||||
def upload_media(self, **params):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue