Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_read_loop() fix attempt #100

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 7 additions & 8 deletions tweepy/streaming.py
Expand Up @@ -136,20 +136,19 @@ def _run(self):
raise

def _read_loop(self, resp):
while self.running:
data = ''
fp=resp.fp
while self.running:
if resp.isclosed():
break

# read length
data = ''
while True:
c = resp.read(1)
if c == '\n':
break
data += c
data = data.strip()
length = fp.readline().strip()
length = int(length,16)

# read data and pass into listener
data = resp._safe_read(length+2)
assert len(data)==length+2
if self.listener.on_data(data) is False:
self.running = False

Expand Down