Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
56391dc8
Commit
56391dc8
authored
Nov 19, 2014
by
Aaron1011
Browse files
Merge pull request #513 from 7kry/master
Modify ReadBuffer for Py3
parents
2c2cc03b
48d2744d
Changes
1
Hide whitespace changes
Inline
Side-by-side
tweepy/streaming.py
View file @
56391dc8
...
...
@@ -146,7 +146,7 @@ class ReadBuffer(object):
def
__init__
(
self
,
stream
,
chunk_size
):
self
.
_stream
=
stream
self
.
_buffer
=
""
self
.
_buffer
=
u
""
self
.
_chunk_size
=
chunk_size
def
read_len
(
self
,
length
):
...
...
@@ -154,7 +154,7 @@ class ReadBuffer(object):
if
len
(
self
.
_buffer
)
>=
length
:
return
self
.
_pop
(
length
)
read_len
=
max
(
self
.
_chunk_size
,
length
-
len
(
self
.
_buffer
))
self
.
_buffer
+=
self
.
_stream
.
read
(
read_len
)
self
.
_buffer
+=
self
.
_stream
.
read
(
read_len
)
.
decode
(
"ascii"
)
def
read_line
(
self
,
sep
=
'
\n
'
):
start
=
0
...
...
@@ -164,7 +164,7 @@ class ReadBuffer(object):
return
self
.
_pop
(
loc
+
len
(
sep
))
else
:
start
=
len
(
self
.
_buffer
)
self
.
_buffer
+=
self
.
_stream
.
read
(
self
.
_chunk_size
)
self
.
_buffer
+=
self
.
_stream
.
read
(
self
.
_chunk_size
)
.
decode
(
"ascii"
)
def
_pop
(
self
,
length
):
r
=
self
.
_buffer
[:
length
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment