Skip to content
Myr

Merge branch 'develop'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 8c1fd5d, 0e711f2 · Browse files · 10 files+76 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+76 added−15 removed

  • other:+76 added−15 removed

10 files+76 added−15 removed

modified:docs/index.rst+2 added-2 removed
96 unmodified lines
97This part of the documentation, which is mostly prose, details the98Requests ecosystem and community.99100.. toctree::101 :maxdepth: 2101 :maxdepth: 1102103 community/faq104 community/out-there.rst105 community/support
17 unmodified lines
123If you want to contribute to the project, this part of the documentation is for124you.125126.. toctree::127 :maxdepth: 2127 :maxdepth: 1128129 dev/internals130 dev/todo131 dev/authors
modified:requests/__init__.py+2 added-2 removed
13 unmodified lines
1415"""1617__title__ = 'requests'18__version__ = '0.8.4'19__build__ = 0x00080418__version__ = '0.8.5'19__build__ = 0x00080520__author__ = 'Kenneth Reitz'21__license__ = 'ISC'22__copyright__ = 'Copyright 2011 Kenneth Reitz'23
11 unmodified lines
modified:requests/api.py-1 removed
11 unmodified lines
12"""1314from . import sessions151616def request(method, url,17 params=None,18 data=None,19 headers=None,
125 unmodified lines
modified:requests/models.py+46 added
570 unmodified lines
571572 return gen573574575 def iter_lines(self, newlines=None, decode_unicode=None):576 """Iterates over the response data, one line at a time. This577 avoids reading the content at once into memory for large578 responses.579580 :param newlines: a collection of bytes to seperate lines with.581 """582583 if newlines is None:584 newlines = ('\r', '\n', '\r\n')585586 if self._content_consumed:587 raise RuntimeError(588 'The content for this response was already consumed'589 )590591 def generate():592 chunk = []593594 while 1:595 c = self.raw.read(1)596 if not c:597 break598599 if c in newlines:600 yield ''.join(chunk)601 chunk = []602 else:603 chunk.append(c)604605 self._content_consumed = True606607 gen = generate()608609 if 'gzip' in self.headers.get('content-encoding', ''):610 gen = stream_decode_gzip(gen)611612 if decode_unicode is None:613 decode_unicode = self.config.get('decode_unicode')614615 if decode_unicode:616 gen = stream_decode_response_unicode(gen, self)617618 return gen619620621 @property622 def content(self):623 """Content of the response, in bytes or unicode624 (if available).
59 unmodified lines
modified:HISTORY.rst+5 added
1History2-------340.8.5 (2011-12-14)5++++++++++++++++++67* Response.iter_lines!890.8.4 (2011-12-11)10++++++++++++++++++1112* Prefetch bugfix.
275 unmodified lines
modified:Makefile+1 added-1 removed
1init:2 pip install -r reqs.txt2 pip install -r requirements.txt34test:5 nosetests --with-color test_requests.py6
10 unmodified lines
modified:NOTICE-1 removed
21 unmodified lines
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER25DEALINGS IN THE SOFTWARE.26
deleted:reqs.txt-7 removed
1envoy==0.0.22httpbin==0.0.43gunicorn4nose5pyflakes6omnijson7rudolf2
added:requirements.txt+7 added
1envoy==0.0.22httpbin==0.0.63gunicorn4nose5pyflakes6omnijson7rudolf2
modified:test_requests.py+13 added-1 removed
426 unmodified lines
427 self.assertEquals(r.status_code, 200)428 self.assertEquals(r.headers['content-type'], 'application/json')429 self.assertEquals(r.url, service('post?test=foo&test=baz'))430 rbody = json.loads(r.content)431 self.assertEquals(rbody.get('form'), dict(test2='foobar',test3='foo'))431 self.assertEquals(rbody.get('form'), dict(test2='foobar',test3=['foo','baz']))432 self.assertEquals(rbody.get('data'), '')433434435 def test_GET_no_redirect(self):
152 unmodified lines
588 assert r1.content589 assert r1.content590591 r2 = requests.get(httpbin('get'), prefetch=True)592 assert r2._content593 assert r2.content594595 def test_iter_lines(self):596597 lines = (0, 2, 10, 100)598599 for i in lines:600601 r = requests.get(httpbin('stream', str(i)), prefetch=False)602 len_lines = len([l for l in r.iter_lines()])603604 self.assertEqual(i, len_lines)605606if __name__ == '__main__':607 unittest.main()