Commit graph

484 commits

Author SHA1 Message Date
Ryan McGrath
68534e8425 Merge pull request #95 from fumieval/master
Supported Proxies
2012-06-24 12:14:44 -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
Mike Helmick
072a257a1f 2.2.0 2012-05-30 11:35:30 -03:00
Mike Helmick
0b3f36f9b6 Need to at least have requests 0.13.0 2012-05-30 11:35:03 -03:00
Ryan McGrath
0d00ae97fb 2.0.1 release, fixes auth error 2012-05-23 18:49:08 +09:00
Ryan McGrath
fff1054e48 Merge pull request #92 from michaelhelmick/auth_fixes
Auth fixes for search and callback url
2012-05-23 02:45:59 -07: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
32a83a6b79 2.1.0 Release
* .md just look cleaner
* Updating documentation to look clean, imo. :P
2012-05-16 18:39:31 -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
f2cd0d5284 2.1.0 release
* README.rst, kind of tried to clean up docs with more examples
* No longer need oauth2 lib 👍
2012-05-16 11:59:47 -04:00
Ryan McGrath
a13f59c5d6 Merge pull request #89 from michaelhelmick/master
Critical bug fixes
2012-05-14 12:32:21 -07:00
Michael Helmick
a4e3af1ad4 Critical bug fixes 2012-05-14 15:16:50 -04:00
Ryan McGrath
30c615908e Merge pull request #88 from michaelhelmick/omit_requestsoauth
Get rid of requests-oauth and a bunch of other schtuff
2012-05-14 08:27:16 -07:00
Michael Helmick
2f80933cb8 Get rid of requests-oauth and a bunch of other schtuff 2012-05-14 11:12:23 -04:00
Ryan McGrath
e36fa35ccd Merge pull request #86 from michaelhelmick/master
2.0 update
2012-05-13 09:42:43 -07: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
9fa9b525a1 Note when upgrading to 1.7.0 2012-05-08 12:29:57 -04: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
Ryan McGrath
22fe97b432 Merge pull request #84 from Voulnet/patch-3
I have added the following lines to the function 'request' starting in l...
2012-04-19 15:26:53 -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
Ryan McGrath
5a332a055e Merge pull request #76 from jvanasco/master
Changed the TwythonError to stash the error_code into self, one or two raises of TwythonError didn't pass in the status code, updated them to do so. (work by @jvanasco)
2012-04-10 08:35:41 -07:00
jonathan vanasco
9b798f7ac0 added error code tracking into the TwythonError 2012-04-10 10:21:00 -04:00
Ryan McGrath
ca76271127 Merge pull request #72 from michaelhelmick/dynamic_requests
Dynamic requests, moving towards 1.6.0.
2012-04-09 18:00:19 -07: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
Ryan McGrath
515e94c994 Merge pull request #73 from eriks5/master
oauth_callback_url cleanup
2012-04-08 17:20:47 -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
Michael Helmick
7205aa402a Get rid of print 2012-04-06 14:19:46 -04:00
Erik
e353125ef1 Removed 'import inspect' as it is no longer needed. 2012-04-06 18:48:26 +02:00
Michael Helmick
703012ef29 Use simplejson if they have it first, allow for version passing in generic requests, catch json decoding errors and status code errors
* Changed the importing order for simplejson, if they have the library
installed, chances are they're going to want to use that over Python
json, json is slower than simplejson

* Version passing is now avaliable

* Catching json decode errors (ValueError) and Twitter Errors on
`_request` method and returning content rather than the response object.
2012-04-06 11:44:30 -04:00
Erik
ffb768d24d Fix adding callback_url for old style servers 2012-04-06 11:09:43 +02:00
Erik
f4c00ff996 If callback_url is not set, don't force it to 'oob' 2012-04-06 11:08:12 +02:00
Erik
e17b3ed877 Removed OAuth library callback_url detection code, as callback_url passing does not depend on that anymore. 2012-04-06 11:02:11 +02:00
Michael Helmick
0fcd4202c8 Whoops.. didn't mean to give those out. Haha. 2012-03-31 20:18:12 -04:00
Michael Helmick
cf38c7c3de POSTing works again, somehow it broke... :/ 2012-03-31 20:16:30 -04:00
Michael Helmick
03f3a22480 Dynamic Request Methods
Just in case Twitter releases something in their API and a developer
wants to implement it on their app, but we haven't gotten around to
putting it in Twython yet. :)
2012-03-31 18:12:07 -04:00