scraperwiki / twitter-follows-tool

Get users who follow or are following a particular user; tool now defunct, though the code is here for reference.
https://blog.scraperwiki.com/2014/08/the-story-of-getting-twitter-data-and-its-missing-middle/
Other
5 stars 7 forks source link

Work around IncompleteRead errors #44

Closed frabcus closed 11 years ago

frabcus commented 11 years ago

Copy this from twitter-search-tool?

# Horrendous hack to work around some Twitter / Python incompatibility
# http://bobrochel.blogspot.co.nz/2010/11/bad-servers-chunked-encoding-and.html
def patch_http_response_read(func):
    def inner(*args):
        try:
            return func(*args)
        except httplib.IncompleteRead, e:
            return e.partial

    return inner
httplib.HTTPResponse.read = patch_http_response_read(httplib.HTTPResponse.read)