Skip to content

Add streaming fix #41

Description

@MichaelCurrin

From
https://stackoverflow.com/questions/26638329/incompleteread-error-when-retrieving-twitter-data-using-python

Found through Kydlaw/pumpy#1 (comment)

When you get a disconnect from urllib ProtocolError, a solution is to add threading so

from queue import Queue
from threading import Thread
class Listener(tweepy.StreamListener):
def __init__(self, q = Queue()):
super().__init__()
self.q = q
for i in range(4):
t = Thread(target=self.do_stuff)
t.daemon = True
t.start()
def on_status(self, status):
print(status)
def do_stuff(self):
while True:
self.q.get()
self.q.task_done()

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions