projects
/
doneit
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
257f198
)
Minor cleaning up of the new read code
author
Ed Page
<eopage@byu.net>
Sat, 25 Apr 2009 03:01:42 +0000
(22:01 -0500)
committer
Ed Page
<eopage@byu.net>
Sat, 25 Apr 2009 03:01:42 +0000
(22:01 -0500)
src/rtm_api.py
patch
|
blob
|
history
diff --git
a/src/rtm_api.py
b/src/rtm_api.py
index
b748b38
..
a184328
100644
(file)
--- a/
src/rtm_api.py
+++ b/
src/rtm_api.py
@@
-103,16
+103,17
@@
class RTMapi(object):
actuallyRead = 0
chunks = []
actuallyRead = 0
chunks = []
+
chunk = connection.read()
chunk = connection.read()
- while 0 < timeout:
- actuallyRead += len(chunk)
- if actuallyRead == specifiedLength:
- break
- chunks.append(chunk)
+ actuallyRead += len(chunk)
+ chunks.append(chunk)
+ while 0 < timeout and actuallyRead < specifiedLength:
time.sleep(1)
timeout -= 1
chunk = connection.read()
time.sleep(1)
timeout -= 1
chunk = connection.read()
- chunks.append(chunk)
+ actuallyRead += len(chunk)
+ chunks.append(chunk)
+
json = "".join(chunks)
if "Content-Length" in connection.info():
json = "".join(chunks)
if "Content-Length" in connection.info():
@@
-131,13
+132,15
@@
class RTMapi(object):
# to grab data.
chunks = []
# to grab data.
chunks = []
+
chunk = connection.read()
chunk = connection.read()
+ chunks.append(chunk)
while chunk and 0 < timeout:
while chunk and 0 < timeout:
- chunks.append(chunk)
time.sleep(1)
timeout -= 1
chunk = connection.read()
time.sleep(1)
timeout -= 1
chunk = connection.read()
- chunks.append(chunk)
+ chunks.append(chunk)
+
json = "".join(chunks)
if "Content-Length" in connection.info():
json = "".join(chunks)
if "Content-Length" in connection.info():