Notes:
* 2.6, 2.7, 3.3 pass.
* 3.4 isn't quite yet available, but is coming soon: https://github.com/travis-ci/travis-ci/issues/1989#issuecomment-39315535
* 3.2 fails because it doesn't have u'uncode stuff' but I guess most Py3 users will be ok with 3.3 or 3.4.
* I've not looked into why pypy fails.
* (This PR also contains the same changes as PR #220.)
Mike Verdone [Tue, 15 Apr 2014 14:55:06 +0000 (16:55 +0200)]
Merge pull request #217 from sixohsix/pickled
Support pickling at the risk of breaking some stuff
- support pickling of responses (#82)
- silence Python 2.6 warning (#179)
- this makes rate-limit headers unavailable on boolean or string responses. I'm not sure if that's a problem.
Mike Verdone [Mon, 24 Mar 2014 20:19:47 +0000 (21:19 +0100)]
Merge pull request #215 from wlonk/colorization
Colorization
I've added some logic to align usernames and wrap tweets. It's preliminary, but hopefully useful. I have tied it in to the ANSI format, because that seems the most human-oriented format.
I'm happy to talk about this more and go back and forth on it, and I hope it's useful!
Mike Verdone [Mon, 24 Mar 2014 20:00:27 +0000 (21:00 +0100)]
Merge pull request #216 from edi-bice/master
--follow-redirects hangs indefinitely on certain urls
urllib2 opener open lacked a timeout parameter causing it to hang indefinitely on certain URLs where the host does not send back any data - added timeout=1 for now and will expose as parameter later - also added socket.timeout exception to list of exceptions handled
Edi Bice [Fri, 21 Mar 2014 20:36:58 +0000 (16:36 -0400)]
urllib2 opener open lacked a timeout parameter causing it to hang indefinitely on certain URLs where the host does not send back any data - added timeout=1 for now and will expose as parameter later - also added socket.timeout exception to list of exceptions handled
Mike Verdone [Thu, 20 Mar 2014 17:45:44 +0000 (18:45 +0100)]
Merge pull request #214 from edi-bice/master
Fixed broken rate limiting error handling in archiver/follow.
Twitter changed rate limiting response objects quite a bit in v1.1.
In addition there were bugs due to import of time module and time object from datetime module.
Edi Bice [Thu, 20 Mar 2014 17:21:10 +0000 (13:21 -0400)]
Fixed broken rate limiting error handling in archiver/follow.
Twitter changed rate limiting response objects quite a bit in v1.1.
In addition there were bugs due to import of time module and time object from datetime module.
Mike Verdone [Wed, 12 Mar 2014 20:34:44 +0000 (21:34 +0100)]
Merge pull request #210 from sixohsix/stream_cleanup_two
Stream cleanup twoSecond time... or third time's a charm. I hope this is it.
- code is actually understandable
- NO MORE UNICODE ERRORS
- NO MORE 100% CPU usage
- return data chunks ASAP
- handle "old school" non-blocking mode (for those who still want it)
- works on all stream servers I have access to
Mike Verdone [Sun, 9 Mar 2014 21:11:15 +0000 (22:11 +0100)]
Merge pull request #205 from sixohsix/stream_cleanup
Explicit support for heartbeat handling
Yet another crack at the stream iterator.
Now we explicitly track timeouts and heartbeat timeouts separately. Regular timeouts produce `Timeout` tokens (dicts). Heartbeat timeouts produce `HeartbeatTimeout` and StopIteration if iterated again. This is a solid fix for issue #202.
If the stream is set to use `timeout=None, block=False`, then we yield only data or `None`. If `timeout` is set to a number, we yield data or `Timeout` tokens, never `None`. If we are set to `block=True` then we yield only data.
Also: improve the documentation and remove some code weirdness.
Also: make the example stream program highly configurable to test every bizarre combination from the command line.
Mike Verdone [Mon, 17 Feb 2014 21:29:35 +0000 (22:29 +0100)]
Merge pull request #203 from RouxRC/pr-fix-timeout
Fix streams timeout & hangup behavior + ensure python2.6 compat
Here are the changes to fix the misbehavior of the timeout in case of low tweets by catching Twitter's keep-alive heartbeat signals thanks to the select.select originally added in #178 and still problematic as pointed out by @ksecrist in #202
I also generalized the hangup to all cases since there is no reason to stay in infinite loop after a hangup in non-blocking mode.
And to make things easier and avoid merging issues, I adapted the refacto and fixed python2.6 compatibility from @adonoho's #201
Mike Verdone [Wed, 12 Feb 2014 14:06:23 +0000 (15:06 +0100)]
Merge pull request #199 from adonoho/use-bytearray-buffer
Reduce memory usage by writing directly into byte array buffer.
Gentlefolk,
The whole point of using a `bytearray` as opposed to concatenating reads of `bytes` was to reduce memory usage. This pull request now takes that strategy to its logical conclusion by writing the balance of the chunk directly into the `bytearray`. This saves the creation of a temporary `bytes` array, up to 8KiB in size.
It does this by creating a `memoryview` of the `bytearray`. While this is still an allocation, the `memoryview`s are much smaller and are, presumably, reclaimed faster.
This patch has been running for over 24 hours and has processed over 4 MTw under Python v3.3.3 on OS X 10.8.5. It has also been run for about 10 minutes on Python v2.7.6 on a similar machine. `memoryview` does not appear to have been backported to Python v2.6.*. Hence, this pull request is incompatible with that platform.
Anon,
Andrew
P.S. The changes in this pull request are larger than strictly necessary for adding this functionality. I chose to improve the naming of my variables and move some of them closer to where they are used.
Mike Verdone [Tue, 4 Feb 2014 14:40:12 +0000 (06:40 -0800)]
Merge pull request #197 from RouxRC/pr-rouxrc
Add image support + fix diverses issues
All right, Mike's motivation was contagious and I cherry-picked and merged my pending commits regarding the other parts than the streaming.
This should fix a few more pending issues I tagged back then : #127 #177 #192 #126 #10 #64
I also seized the occasion to add @adonoho among the authors as well.
RouxRC [Sat, 28 Dec 2013 16:56:46 +0000 (17:56 +0100)]
Complete tildes fix for python 2
The fix #64 by @grahame was fixing the issue of sending tweets with
'~' for python 3 but not for python 2 due to urllib.urlencode's lack
of safe functions. Here's a dirty hack to do it anyway.
Any better fix welcome :)
RouxRC [Sat, 28 Dec 2013 16:44:14 +0000 (17:44 +0100)]
Handle multipart oauth to use image sending api
So the calls to send media (update_with_media, update_profile_image,
update_profile_background_image and update_profile_banner) require
to send queries differently, as multipart form, and oauth needs to be
signed without taking any parameter into account.
This does the trick, following the rules here and there:
https://dev.twitter.com/docs/uploading-media
https://dev.twitter.com/docs/api/1.1/post/statuses/update_with_media
https://dev.twitter.com/discussions/1059
RouxRC [Fri, 27 Dec 2013 09:38:15 +0000 (10:38 +0100)]
Use POST for all methods requiring it in specs
Added all missing methods from https://dev.twitter.com/docs/api/1.1
Also included some of the streaming methods which work with both GET
and POST but accept arguments like "track" which can quickly require
POST.