tweepy: Connection broken: IncompleteRead

This happened and wasn’t handled properly. Expected behaviour - reconnection

Traceback (most recent call last):¡ãç°¡å
  File "./feeder.py", line 78, in <module>
    stream.filter(**filterargs)
  File "build/bdist.linux-x86_64/egg/tweepy/streaming.py", line 430, in filter
  File "build/bdist.linux-x86_64/egg/tweepy/streaming.py", line 346, in _start
  File "build/bdist.linux-x86_64/egg/tweepy/streaming.py", line 286, in _run
requests.packages.urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(0 bytes read, 512 more expected)', IncompleteRead(0 bytes read, 512 more expected))

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 23 (1 by maintainers)

Commits related to this issue

Most upvoted comments

On simple method to handle/suppress the exception is to override the on_exception() function in tweepy streaming listener class.

Class MyListener(StreamListener):
       def on_status(self, status):
                <ur_code>
 
      def on_data(self,data):
               <ur_code>

        def on_exception(self, exception):
               print(exception)
               return

i don’t think adding in on_data works… just overriding on_exception() as i have done for example is simple and works perfectly.