mellort/reddit_api — pull request #62 by marblar (2012-02-13 03:05:25+00:00)
Title: httplib.IncompleteRead exception handling

While crawling comments, every hour or two I would get an exception with a traceback ending with:
httplib.IncompleteRead: IncompleteRead(1555 bytes read)

This may be an problem on my end, or an issue with Reddit. Regardless, the library should probably be able to work through this hiccup without ending the whole program.

So I added exception handling for http.IncompleteRead to response.read() in helpers._request. If the connection is terminated before read is complete, the response will be read again until successful or a different error is raised. Repeating the whole read operation does not seem to be an issue since the amount of data lost was relatively small.