Merge remote-tracking branch 'origin/master'
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 584cfb6, d74bd7e · Browse files · 10 files·+28 added−19 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+28 added−19 removed
- other:+28 added−19 removed
Provenance
- Commit
7e47d5e- Tree
573a76f- Author
Kenneth Reitz <me@kennethreitz.com>- Committer
Kenneth Reitz <me@kennethreitz.com>- Parent 1
584cfb6- Parent 2
d74bd7e
10 files changed+28 added−19 removed
modified:docs/user/intro.rst+4 added-4 removed
15 unmodified lines16 #. Readability counts.17 18 All contributions to Requests should keep these important rules in mind.19 20-.. _`isc`:20+.. _`apache2`:21 22-ISC License22+Apache2 License23 -----------24 25 A large number of open source projects you find today are `GPL Licensed`_.26 While the GPL has its time and place, it should most certainly not be your5 unmodified lines32 The MIT, BSD, ISC, and Apache2 licenses are great alternatives to the GPL33 that allow your open-source software to be used freely in proprietary,34 closed-source software.35 36-Requests is released under terms of `The ISC License`_.36+Requests is released under terms of `Apache2 License`_.37 38 .. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php39-.. _`The ISC License`: http://www.opensource.org/licenses/isc-license39+.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.040 41 42 Requests License43 ----------------2 unmodified linesmodified:docs/user/quickstart.rst+4 added-3 removed
135 unmodified lines136 137 Raw Response Content138 --------------------139 140-In the rare case that you'd like to get the absolute raw socket response from the server,141-you can access ``r.raw``::140+In the rare case that you'd like to get the raw socket response from the141+server, you can access ``r.raw``. If you want to do this, make sure you set142+``prefetch=False`` in your initial request. Once you do, you can do this::143 144+ >>> r = requests.get('https:/github.com/timeline.json', prefetch=False)145 >>> r.raw146 <requests.packages.urllib3.response.HTTPResponse object at 0x101194810>145-147 >>> r.raw.read(10)148 '\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'149 150 345 unmodified linesmodified:docs/index.rst+1 added-1 removed
6 unmodified lines7 =========================8 9 Release v\ |version|. (:ref:`Installation <install>`)10 11-Requests is an :ref:`ISC Licensed <isc>` HTTP library, written in Python, for human beings.11+Requests is an :ref:`Apache2 Licensed <apache2>` HTTP library, written in Python, for human beings.12 13 Python's standard **urllib2** module provides most of14 the HTTP capabilities you need, but the API is thoroughly **broken**.15 It was built for a different time — and a different web. It requires an *enormous* amount of work (even method overrides) to perform the simplest of tasks.117 unmodified linesmodified:requests/__init__.py+2 added-2 removed
35 unmodified lines36 The other HTTP methods are supported - see `requests.api`. Full documentation37 is at <http://python-requests.org>.38 39 :copyright: (c) 2012 by Kenneth Reitz.40-:license: ISC, see LICENSE for more details.40+:license: Apache 2.0, see LICENSE for more details.41 42 """43 44 __title__ = 'requests'45 __version__ = '0.14.2'46 __build__ = 0x00140247 __author__ = 'Kenneth Reitz'48-__license__ = 'ISC'48+__license__ = 'Apache 2.0'49 __copyright__ = 'Copyright 2012 Kenneth Reitz'50 51 52 from . import utils8 unmodified linesmodified:requests/api.py+2 added-2 removed
5 unmodified lines6 7 This module implements the Requests API.8 9 :copyright: (c) 2012 by Kenneth Reitz.10-:license: ISC, see LICENSE for more details.10+:license: Apache2, see LICENSE for more details.11 12 """13 14 from . import sessions26 unmodified lines41 # if we're making it just for this call, then close it when we're done.42 adhoc_session = False43 session = kwargs.pop('session', None)44 if session is None:45- session = sessions.session()45+ session = sessions.session(config=kwargs.get('config', None))46 adhoc_session = True47 48 try:49 return session.request(method=method, url=url, **kwargs)79 unmodified linesmodified:requests/defaults.py+1 added
41 unmodified lines42 defaults['keep_alive'] = True43 defaults['encode_uri'] = True44 defaults['trust_env'] = True45 defaults['store_cookies'] = True46+defaults['support_http0.9'] = Truemodified:requests/models.py+3 added-1 removed
231 unmodified lines232 r = build(resp)233 234 if r.status_code in REDIRECT_STATI and not self.redirect:235 236- while (('location' in r.headers) and236+ while (('location' in r.headers and r.status_code in REDIRECT_STATI) and237 ((r.status_code is codes.see_other) or (self.allow_redirects))):238 239 r.content # Consume socket so it can be released240 458 unmodified lines699 #: value of a ``'Content-Encoding'`` response header.700 self.headers = CaseInsensitiveDict()701 702 #: File-like object representation of response (for advanced usage).703+ #: Requires that ``prefetch=False` on the request.704+ # This requirement does not apply for use internally to Requests.705 self.raw = None706 707 #: Final URL location of Response.708 self.url = None213 unmodified linesmodified:requests/sessions.py+2 added-1 removed
123 unmodified lines124 125 def init_poolmanager(self):126 self.poolmanager = PoolManager(127 num_pools=self.config.get('pool_connections'),128- maxsize=self.config.get('pool_maxsize')128+ maxsize=self.config.get('pool_maxsize'),129+ strict=not self.config.get('support_http0.9')130 )131 132 def __repr__(self):133 return '<requests-client at 0x%x>' % (id(self))227 unmodified linesmodified:README.rst+8 added-4 removed
3 unmodified lines4 5 .. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop6 :target: https://secure.travis-ci.org/kennethreitz/requests7 8-Requests is an ISC Licensed HTTP library, written in Python, for human8+Requests is an Apache2 Licensed HTTP library, written in Python, for human9 beings.10 11 Most existing Python modules for sending HTTP requests are extremely12 verbose and cumbersome. Python's builtin urllib2 module provides most of2 unmodified lines15 perform the simplest of tasks.16 17 Things shouldn't be this way. Not in Python.18 19-::19+.. code-block:: pycon20 21 >>> r = requests.get('https://api.github.com', auth=('user', 'pass'))22 >>> r.status_code23 20429 unmodified lines53 54 Installation55 ------------56 57-To install requests, simply: ::57+To install requests, simply:58 59+.. code-block:: bash60+61 $ pip install requests62 61-Or, if you absolutely must: ::63+Or, if you absolutely must:64 65+.. code-block:: bash66+67 $ easy_install requests68 69 But, you really shouldn't do that.70 12 unmodified linesmodified:setup.py+1 added-1 removed
43 unmodified lines44 classifiers=(45 'Development Status :: 5 - Production/Stable',46 'Intended Audience :: Developers',47 'Natural Language :: English',48- 'License :: OSI Approved :: ISC License (ISCL)',48+ 'License :: OSI Approved :: Apache Software License',49 'Programming Language :: Python',50 'Programming Language :: Python :: 2.6',51 'Programming Language :: Python :: 2.7',52 'Programming Language :: Python :: 3',6 unmodified lines