Don't busywait forever if Twitter hangs up on us.
Do not send gzip header for streaming calls

Twitter is moving all of its APIs towards HTTP1.1.
https://dev.twitter.com/blog/deprecating-http-1.0-streaming-api
Userstream passed already mid-november and has been borken for this lib since
On Jan 6, Twitter will apply it as weel for all the other stream methods,
meaning they probably would be all broken.

The problem was in two pieces.
First with this commit, we stop asking for gzip encoded data for streaming
calls: for the HTPP1.0 calls, this was not taken into account anyway, but with
HTTP1.1 the answer is now chunked and should therefore not caught zipped.

(First part of fix for userstream and soon all streams cf #190 #116)
Parse http1.1 chunks to find json

Chunked data sent via HTTP1.1 by Twitter is not as straight forward to read,
chunks indicating size of tweets are present no matter what, so we find the
json start in the buffer and forget the rest for now.

(Second part of correction for userstream and soon all streams. Fix #190 #116)
Respect "delimited" argument from Streaming API

Instead of trashing it as in previous commit, return the sizes of the messages
sent by the API as regular messages if requested through the normal API
argument 'delimited=length'
https://dev.twitter.com/docs/streaming-apis/parameters#delimited

(Last part of userstream and other streams fix)
Fix blockedcalls on lowtraffic stream with timeout

When running a stream with a low traffic, the current timeout logic was
hanging indefinitely without processing.
This rewritten logic seems to be working fine now with both http1.0 and 1.1
and active or low traffic.

@dkanygin: would love to get your code review on this (cf #178)
Syntax
Fix missing TwitterHTTPError in Streaming

The existing error was never reached, luckily since it was using
undefined arguments. moved it in its right place and added handling
ssl errors as TwitterHTTPError.

(Fix #136)
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.

(Closes #187 #145 #188)
Keep gzip for other methods than streaming

Oups, the default for all other methods should be True, not False
Fix broken follow create/destroy in cmdline & bot

Adapt argument calls to the intended behavior

Fixes #177 #192 #126 #10
authorship
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

Closes #127
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 :)
Fix tilde fixing...

convert non string before replacing in it...
(follows da33e70db0a0469dd8990b1ca3e7b06445529ea2 )
Fix misuse of TwitterHTTPError from 3d29eaed64
Stream with timeout should also yield None

Even when there is a low traffic, we know we didn't lose the
connection yet when ready_to_read indicates a signal from Twitter,
so we don't yield any timeout message and continue, but we should
at least yield None like in the non-blocking mode to allow
iterator's use to get the hand back and exit cleanly if required.

Completes 3df3413dc8
Ping @dkanygin #178
Fixed SSL streaming errors catch

TwitterHTTPError should not be tried to be made from SSLError, the
original behavior of just raising this is best, my bad...

(Follows 040f13e9fde4ae411c081bd64bd62ce9e4cbe14a )
Merge branch 'fix-broken-streams' of github.com:RouxRC/twitter

Conflicts:
	twitter/stream.py
avoid a test that got broken again
Increment version number so we can tell when this is deployed