- Added
html_for_tweet
static method. This method accepts a tweet object returned from a Twitter API call and will return a string with urls, mentions and hashtags in the tweet replaced with HTML. - Pass
client_args
to the streaming__init__
, much like in core Twython (you can pass headers, timeout, hooks, proxies, etc.). - Streamer has new parameter
handlers
which accepts a list of strings related to functions that are apart of the Streaming class and start with "on_". i.e. ['delete'] is passed, when 'delete' is received from a stream response;on_delete
will be called. - When an actual request error happens and a
RequestException
is raised, it is caught and aTwythonError
is raised instead for convenience. - Added "cursor"-like functionality. Endpoints with the attribute
iter_mode
will be able to be passed toTwython.cursor
and returned as a generator. Twython.search_gen
has been deprecated. Please usetwitter.cursor(twitter.search, q='your_query')
instead, wheretwitter
is yourTwython
instance.- Added methods
get_list_memberships
,get_twitter_configuration
,get_supported_languages
,get_privacy_policy
,get_tos
- Added
auth_endpoint
parameter toTwython.__init__
for cases when the right parameters weren't being shown during the authentication step.
- Changed
twython/twython.py
totwython/api.py
in attempt to make structure look a little neater - Removed all camelCase function access (anything like
getHomeTimeline
is nowget_home_timeline
) - Removed
shorten_url
. With therequests
library, shortening a URL on your own is simple enough twitter_token
,twitter_secret
andcallback_url
are no longer passed toTwython.__init__
twitter_token
andtwitter_secret
have been replaced withapp_key
andapp_secret
respectivelycallback_url
is now passed throughTwython.get_authentication_tokens
- Update
test_twython.py
docstrings per http://www.python.org/dev/peps/pep-0257/ - Removed
get_list_memberships
, method is Twitter API 1.0 deprecated - Developers can now pass an array as a parameter to Twitter API methods and they will be automatically joined by a comma and converted to a string
endpoints.py
now containsEndpointsMixin
(rather than the previousapi_table
dict) for Twython, which enables Twython to use functions declared in the Mixin.- Added OAuth 2 authentication (Application Only) for when you want to make read-only calls to Twitter without having to go through the whole user authentication ritual (see docs for usage)
- Added
obtain_access_token
to obtain an OAuth 2 Application Only read-only access token construct_api_url
now accepts keyword arguments like other Twython methods (e.g. instead of passing{'q': 'twitter', 'result_type': 'recent'}
, passq='twitter', result_type='recent'
)- Pass
client_args
to the Twython__init__
to manipulate request variables.client_args
accepts a dictionary of keywords and values that accepted byrequests
(Session API) [ex. headers, proxies, verify(SSL verification)] and the "request" section directly below it. - Added
get_application_rate_limit_status
API method for returning the current rate limits for the specified source - Added
invalidate_token
API method which allows registed apps to revoke an access token presenting its client credentials get_lastfunction_header
now accepts adefault_return_value
parameter. This means that if you pass a second value (ex.Twython.get_lastfunction_header('x-rate-limit-remaining', 0)
) and the value is not found, it returns your default value
- More test coverage!
- Fix
search_gen
- Fixed
get_lastfunction_header
to actually do what its docstring says, returnsNone
if header is not found - Updated some internal API code,
__init__
didn't need to haveself.auth
andself.headers
because they were never used anywhere else but the__init__
- Added
disconnect
method toTwythonStreamer
, allowing users to disconnect as they desire - Updated
TwythonStreamError
docstring, also allow importing it fromtwython
- No longer raise
TwythonStreamError
when stream line can't be decoded. Instead, sends signal toTwythonStreamer.on_error
- Allow for (int, long, float) params to be passed to Twython Twitter API functions in Python 2, and (int, float) in Python 3
- Added
get_retweeters_ids
method - Fixed
TwythonDeprecationWarning
on camelCase functions if the camelCase was the same as the PEP8 function (i.e.Twython.retweet
did not change) - Fixed error message bubbling when error message returned from Twitter was not an array (i.e. if you try to retweet something twice, the error is not found at index 0)
- Added "transparent" parameters for making requests, meaning users can pass bool values (True, False) to Twython methods and we convert your params in the background to satisfy the Twitter API. Also, file objects can now be passed seamlessly (see examples in README and in /examples dir for details)
- Callback URL is optional in
get_authentication_tokens
to accomedate those using OOB authorization (non web clients) - Not part of the python package, but tests are now available along with Travis CI hooks
- Added
__repr__
definition for Twython, when calling only returning <Twython: APP_KEY> - Cleaned up
Twython.construct_api_url
, uses "transparent" parameters (see 4th bullet in this version for explaination) - Update
requests
andrequests-oauthlib
requirements, fixing posting files AND post data together, making authenticated requests in general in Python 3.3
- "PEP8" all the functions. Switch functions from camelCase() to underscore_funcs(). (i.e.
updateStatus()
is nowupdate_status()
)
- Fixed streaming issue #144, added
TwythonStreamer
to aid users in a friendly streaming experience (streaming examples inexamples
and README's have been updated as well) Twython
now requiresrequests-oauthlib
0.3.1, fixes #154 (unable to upload media when sending POST data with the file)
- Added a
HISTORY.rst
to start tracking history of changes - Updated
twitter_endpoints.py
toendpoints.py
for cleanliness - Removed twython3k directory, no longer needed
- Added
compat.py
for compatability with Python 2.6 and greater - Added some ascii art, moved description of Twython and
__author__
to__init__.py
- Added
version.py
to store the current Twython version, instead of repeating it twice -- it also had to go into it's own file because of dependencies ofrequests
andrequests-oauthlib
, install would fail because those libraries weren't installed yet (on fresh install of Twython) - Removed
find_packages()
fromsetup.py
, only one package (we can just define it) - added quick publish method for Ryan and I:
python setup.py publish
is faster to type and easier to remember thanpython setup.py sdist upload
- Removed
base_url
fromendpoints.py
because we're just repeating it inTwython.__init__
Twython.get_authentication_tokens()
now takescallback_url
argument rather than passing thecallback_url
throughTwython.__init__
,callback_url
is only used in theget_authentication_tokens
method and nowhere else (kept in init though for backwards compatability)- Updated README to better reflect current Twython codebase
- Added
warnings.simplefilter('default')
line intwython.py
for Python 2.7 and greater to display Deprecation Warnings in console - Added Deprecation Warnings for usage of
twitter_token
,twitter_secret
andcallback_url
inTwython.__init__
- Headers now always include the User-Agent as Twython vXX unless User-Agent is overwritten
- Removed senseless TwythonError thrown if method is not GET or POST, who cares -- if the user passes something other than GET or POST just let Twitter return the error that they messed up
- Removed conversion to unicode of (int, bool) params passed to a requests.
requests
isn't greedy about variables that can't be converted to unicode anymore - 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 ryanmcgrath#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 usedself.post
- Fixed issue where Twython Exceptions were not being logged correctly
- Fixed
AttributeError
when trying to decode the JSON response viaResponse.json()
- Removed
simplejson
dependency - Fixed
destroyDirectMessage
,createBlock
,destroyBlock
endpoints intwitter_endpoints.py
- Added
getProfileBannerSizes
method totwitter_endpoints.py
- Made oauth_verifier argument required in
get_authorized_tokens
- Update
updateProfileBannerImage
to use v1.1 endpoint
- New
showOwnedLists
method
- Added missing slash to
getMentionsTimeline
intwitter_endpoints.py
- Updated
twitter_endpoints.py
to better reflect order of API endpoints on the Twitter API v1.1 docs site