equal
deleted
inserted
replaced
29 """Reader objects to abstract out different body response types. |
29 """Reader objects to abstract out different body response types. |
30 |
30 |
31 This module is package-private. It is not expected that these will |
31 This module is package-private. It is not expected that these will |
32 have any clients outside of httpplus. |
32 have any clients outside of httpplus. |
33 """ |
33 """ |
|
34 from __future__ import absolute_import |
34 |
35 |
35 import httplib |
36 import httplib |
36 import logging |
37 import logging |
37 |
38 |
38 logger = logging.getLogger(__name__) |
39 logger = logging.getLogger(__name__) |
96 assert len(result) == amt or (self._finished and len(result) < amt) |
97 assert len(result) == amt or (self._finished and len(result) < amt) |
97 |
98 |
98 return result |
99 return result |
99 |
100 |
100 def readto(self, delimstr, blocks = None): |
101 def readto(self, delimstr, blocks = None): |
101 """return available data chunks up to the first one in which delimstr |
102 """return available data chunks up to the first one in which |
102 occurs. No data will be returned after delimstr -- the chunk in which |
103 delimstr occurs. No data will be returned after delimstr -- |
103 it occurs will be split and the remainder pushed back onto the available |
104 the chunk in which it occurs will be split and the remainder |
104 data queue. If blocks is supplied chunks will be added to blocks, otherwise |
105 pushed back onto the available data queue. If blocks is |
105 a new list will be allocated. |
106 supplied chunks will be added to blocks, otherwise a new list |
|
107 will be allocated. |
106 """ |
108 """ |
107 if blocks is None: |
109 if blocks is None: |
108 blocks = [] |
110 blocks = [] |
109 |
111 |
110 while self._done_chunks: |
112 while self._done_chunks: |