Commit graph

297 commits

Author SHA1 Message Date
Mike Helmick
b314a5606e Deleting auth stuff, oops 2012-10-04 16:56:20 -04:00
Mike Helmick
a3967390e1 Moved around some code, support for removing and updating Profile Banners
Line 213 needs to check for status code as well now because
remove/updating banner does not return content, only status code
2012-10-04 16:53:28 -04:00
Mike Helmick
448b4f27b6 Update requests version and Twython version 2012-10-04 14:08:46 -04:00
Christopher Brown
0c25651921 Use version 1.1 for everything, especially search 2012-09-13 22:38:05 -05:00
Mike Helmick
8e72adead2 Version bump since new endpoint added, update requests version 2012-08-31 14:22:48 -04:00
Denis Veselov
156368cf6e add myTotals endpoint for py2k 2012-08-28 00:48:32 +04:00
Ryan McGrath
a489a47a67 Merge pull request #110 from jvanasco/master
better handling of API errors
2012-08-25 16:30:03 -07:00
jonathan vanasco
341fdd8f49 removed prints. dumb me 2012-08-01 13:53:44 -04:00
jonathan vanasco
9d21865409 adjusted the logic in the twitter response reader to better handle API errors.
this could likely be done a bit cleaner -- but this works.
2012-08-01 13:32:06 -04:00
Mike Helmick
9e5a96655d 2.3.4 release, requires requests 0.13.4 >, basically we don't have to url encode params anymore and can just pass a dict of params to the request (finally! :D) 2012-07-27 12:10:36 -04:00
Ryan McGrath
e1c4035a63 Version bump for bug-fix rollout 2012-07-25 03:56:12 +09:00
lucadex
c5468ee1b5 Update twython/__init__.py 2012-07-24 12:45:32 +03:00
Mohmmadhd
7986da859f Update master 2012-07-10 15:22:31 +03:00
Ryan McGrath
0bcc15ecf3 2.3.2, latest @michaelhelmick fixes 2012-06-30 01:55:30 +09:00
Mike Helmick
d864376816 Code cleanup, Update requests version
* No sense in setting self.auth twice
* Make self.client a requests.session to reuse headers and auth
* requests 0.13.2 dependency isn't needed, but doesn't hurt
2012-06-29 12:19:37 -04:00
Ryan McGrath
73a1910066 Version bump for 2.3.1 release 2012-06-30 00:52:40 +09:00
Mike Helmick
f4b2ebc40a This func no longer needs to urlencode the query, _request does it 2012-06-28 11:13:49 -04:00
Mike Helmick
a9b7b836c9 Fixes #103
Fix #93 is incorrect. We can avoid this by just removing the check and
quote_plus
2012-06-28 11:08:59 -04:00
Mike Grouchy
b552913e53 Fixed broken params kwargs which was breaking updateStatusWithMedia
* params are passed as **kwargs everywhere else, so updated
_media_update to be consistent with that.
* updated to updateProfileBackgroundImage to fall in line with
 _media_update changes.
2012-06-27 09:53:35 -04:00
Mike Helmick
2155ae0c23 Fix error in README.md, strip some not-needed comments and fixed a ternary 2012-06-25 11:50:44 -04:00
Ryan McGrath
068c504030 Merge branch 'requests_image_posting' (Pull Request #91)
- Fixes for README
- Re-added a bulkUserLookup method that warns for deprecation
- Merged in @michaelhelmick's work on media and oauth2 deprecation

Conflicts:
	setup.py
	twython/twython.py
2012-06-25 05:02:57 +09:00
Ryan McGrath
79842875be Merge pull request #97 from terrycojones/call-parent-init-in-exception-classes-96
call-parent-init-in-exception-classes-96
2012-06-24 12:16:34 -07:00
Ryan McGrath
9d57f34fce Merge pull request #93 from leandroferreira/master
corrected issue when searches with "q" gets encoded twice
2012-06-24 12:15:10 -07:00
terrycojones
1261b7b304 Some small suggested clean-ups with error / exception processing. 2012-06-11 15:48:24 -04:00
fumieval
3f4e374911 fixed the mistake that prints proxies to console for debugging. 2012-06-03 18:43:09 +09:00
fumieval
7caa688146 Supported proxies, just added an argument to Twython.__init__. 2012-06-03 18:25:25 +09:00
Leandro Ferreira
92f9c94146 Corrected when search q gets encoded twice 2012-05-31 10:59:43 -03:00
Mike Helmick
f232b873cb 2.2.0 2012-05-30 11:35:51 -03:00
Ryan McGrath
0d00ae97fb 2.0.1 release, fixes auth error 2012-05-23 18:49:08 +09:00
Michael Helmick
fc9e21435e Auth fixes for search and callback url 2012-05-22 10:40:38 -04:00
Michael Helmick
d93b48cded 2.1.0 Release
Set `self.auth` = None so that calls (like searching or getting a
profile avatar don't error out) Fixes 90
2012-05-17 12:22:37 -04:00
Michael Helmick
5e817195ac 2.1.0 Release
* Removal of oauth2 lib, `requests` has fully taken over. :)
* FIXED: Obtaining auth url with specified callback was broke..
wouldn't give you auth url if you specified a callback url
* Updated requests to pass the headers that are passed in the init, so
User-Agent is once again `Twython Python Twitter Library v2.1.0`
👍 :)
* Catching exception when Stream API doesn't return valid JSON to parse
* Removed `DELETE` method. As of the Spring 2012 clean up, Twitter no
longer supports this method
* Updated `post` internal func to take files as kwarg
* `params - params or {}` only needs to be done in `_request`, just a
lot of redundant code on my part, sorry ;P
* Removed `bulkUserLookup`, there is no need for this to be a special
case, anyone can pass a string of username or user ids and chances are
if they're reading the docs and using this library they'll understand
how to use `lookupUser()` in `twitter_endpoints.py` passing params
provided in the Twitter docs
* Changed internal `oauth_secret` variable to be more consistent with
the keyword arg in the init `oauth_token_secret`
2012-05-16 12:09:26 -04:00
Michael Helmick
a4e3af1ad4 Critical bug fixes 2012-05-14 15:16:50 -04:00
Michael Helmick
2f80933cb8 Get rid of requests-oauth and a bunch of other schtuff 2012-05-14 11:12:23 -04:00
Michael Helmick
19293b54a9 Remove exceptions and methods in 2.0
* update twitter_endpoints with isListSubscriber and isListMember
instead of having them in twython.py

* app_key and app_secret in place to take over twitter_token and
twitter_secret

* updated methods to have the short hand description show up, should
always be on first line and the description.. not repeating the function

* fixed other method docs and stuff
2012-05-13 12:38:30 -04:00
Ryan McGrath
59c723ed7e Merge branch 'method_cleanups' from @michaelhelmick
Addresses most changes and issues with Twitter Spring cleanup 2012. Documentation
update on methods, started move to docs in RST format. Exceptions set to eventually
be deprecated (along with search functions).

Conflicts:
	twython/twython.py
2012-05-14 00:42:19 +09:00
Michael Helmick
0ee5e5877e Cleaning up endpoints per Twitter Spring 2012 deprecations
https://dev.twitter.com/docs/deprecations/spring-2012
2012-05-08 12:14:45 -04:00
Michael Helmick
ac18837ed6 Should be good for auto-merge
* Fixed a typo - 'startwith' replaced with 'startswith'
* Got rid of constructApiUrl, it's no longer needed, self.request()
does it internally
* A bunch of odds and ends to get this to auto-merge finally?! :D
2012-04-19 19:31:07 -04:00
Ryan McGrath
c16ec65915 Resolving merge conflicts, because Ryan is an idiot 2012-04-19 18:39:37 -04:00
Ryan McGrath
aabd29a01e Swap http => https for endpoint access, added Voulnet to contributers in the README 2012-04-19 18:38:10 -04:00
Ryan McGrath
6ebf6df884 Merge pull request #83 from Voulnet/patch-2
I fixed line 479 to properly URL encode the querystring (q parameter) fo...
2012-04-19 15:28:21 -07:00
Mohammed ALDOUB
01a7284a8f I have added the following lines to the function 'request' starting in line 287:
# convert any http Twitter url into https, for the sake of user security
        # only convert the protocol part, not all occurences of http://, in case users want to search that
        endpoint = endpoint.replace('http://','https://',1)

This is to ensure all passed Twitter urls are converted into https, without messing with the rest of the url.
2012-04-14 05:53:51 +03:00
Mohammed ALDOUB
343dcb87ff I fixed line 479 to properly URL encode the querystring (q parameter) for the search functionality. According to http://dev.twitter.com/doc/get/search, the q parameter should be URL encoded, but Twython.unicode2utf8 doesn't urlencode the query.
So I enclosed it in a urllib.quote_plus function call.

examples: 

>>> urllib.quote_plus(Twython.unicode2utf8('h ^&$'))
'h+%5E%26%24'  
>>> Twython.unicode2utf8('h ^&$')
'h ^&$'
>>>
2012-04-14 05:34:22 +03:00
Michael Helmick
a42570b685 Trying to make this merge-able.
* We don't need RequestException anymore.

* I changed TwythonError to raise TwythonRateLimitError instead of
TwythonAPIError since TwythonRateLimitError is more verbose and in the
belief we should deprecate TwythonAPILimit and ultimately remove it in
2.0

* And I updated the version to 1.7.0 -- I feel like development as far
as versioning seems like it's going fast, but versioning is versioning
and I'm following Twitter's rhythm of versioning
<major>.<minor>.<bugfix>, minor changing when minor features or
significant fixes have been added. In this case, TwythonRateLimitError
should start being caught in place of TwythonAPILimit
2012-04-12 11:44:27 -04:00
Michael Helmick
3f26325ddb Updating methods to use internal get/post methods, updating methods using deprecated Twitter endpoints, updating some documentation on methods to start using rst format, plotting demise of deprecated Twython exceptiosn and methods >:)
* Updated all methods to use the internal get/post methods

* isListMember was using the deprecated *GET
:user/:list_id/members/:id* Twitter endpoint

* isListMember was also using a deprecated method

* Changed documentation on methods, the first line should be what the
method does (docstring)

* Started to change documentation for methods to use rst (restructed
text) -- What PyPi supports as well as Sphinx generator and others
instead of Markdown

* Planning to get rid of Exceptions - TwythonAPILimit, APILimit,
AuthError and Methods - searchTwitter(), searchTwitterGen()
2012-04-10 14:24:50 -04:00
jonathan vanasco
9b798f7ac0 added error code tracking into the TwythonError 2012-04-10 10:21:00 -04:00
Michael Helmick
813626a9ad Maybe the twitter_http_status_codes were a good idea. :P
I still think it's weird to have them, but I'm not against giving the
user more information. I put back in the twitter_http_status_codes
variable, but I changed where the logic was being handled, instead of
it happening the in _request, it will be asserted in Twython error if
an error_code is passed AND the error_code is in
twitter_http_status_codes
2012-04-09 10:59:13 -04:00
Michael Helmick
eb22296e33 Merged dynamic_requests with recent pull request additions
* Removed twitter_http_status_codes. Unnecessary variable when we are
giving them the error back.

* Added a "Please see..." message to TwythonError if the exception
passes an error code, linking to Twitter API error response page.

* Merged stuff from constructFunc into _request()
2012-04-09 10:49:44 -04:00
Ryan McGrath
4042407970 Merge pull request #74 from jvanasco/master
Enhanced debugging support courtesy of jvanasco.
2012-04-08 17:29:06 -07:00
jonathan vanasco
59b0386564 Several improvements to allow for debugging , error handling :
- added twitter's http status codes to twitter_endpoints.py ( dict index on status code, value is a tuple of name + description )
- created an internal stash called '_last_call' that stores details of the last api call ( the call, response data, headers, url, etc )
- better error handling for api issues:
- - raises an error when the status code is not 200 or 304
- - raises TwythonAPILimit when a 420 rate limit code is returned
- - raises a TwythonError on other issues, setting the correct status code and using messages that are from the twitter API
- wraps a successful read in a try/except block.  there's an error i haven't been able to reproduce where invalid content can get in there, it would be nice to catch it and write a handler for it.  ( the previous functions were all introducted to allow this to be debugged )
- added a 'get_lastfunction_header' method. if the API has not been called yet , raises a TwythonError.  otherwise it attempts to return the header value twitter last sent.  useful for x-ratelimit-limit , x-ratelimit-remaining , x-ratelimit-class , x-ratelimit-reset
2012-04-08 18:37:47 -04:00