diff --git a/README.rst b/README.rst index b9e039f5..64021b8c 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Requests: HTTP for Humans .. image:: https://secure.travis-ci.org/kennethreitz/requests.png?branch=develop :target: https://secure.travis-ci.org/kennethreitz/requests -Requests is an ISC Licensed HTTP library, written in Python, for human +Requests is an Apache2 Licensed HTTP library, written in Python, for human beings. Most existing Python modules for sending HTTP requests are extremely @@ -16,7 +16,7 @@ perform the simplest of tasks. Things shouldn't be this way. Not in Python. -:: +.. code-block:: pycon >>> r = requests.get('https://api.github.com', auth=('user', 'pass')) >>> r.status_code @@ -54,11 +54,15 @@ Features Installation ------------ -To install requests, simply: :: +To install requests, simply: + +.. code-block:: bash $ pip install requests -Or, if you absolutely must: :: +Or, if you absolutely must: + +.. code-block:: bash $ easy_install requests diff --git a/docs/index.rst b/docs/index.rst index d469c66d..312c4e7e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,7 +8,7 @@ Requests: HTTP for Humans Release v\ |version|. (:ref:`Installation `) -Requests is an :ref:`ISC Licensed ` HTTP library, written in Python, for human beings. +Requests is an :ref:`Apache2 Licensed ` HTTP library, written in Python, for human beings. Python's standard **urllib2** module provides most of the HTTP capabilities you need, but the API is thoroughly **broken**. diff --git a/docs/user/intro.rst b/docs/user/intro.rst index c40528de..ae5e6393 100644 --- a/docs/user/intro.rst +++ b/docs/user/intro.rst @@ -17,9 +17,9 @@ Requests was developed with a few :pep:`20` idioms in mind. All contributions to Requests should keep these important rules in mind. -.. _`isc`: +.. _`apache2`: -ISC License +Apache2 License ----------- A large number of open source projects you find today are `GPL Licensed`_. @@ -33,10 +33,10 @@ The MIT, BSD, ISC, and Apache2 licenses are great alternatives to the GPL that allow your open-source software to be used freely in proprietary, closed-source software. -Requests is released under terms of `The ISC License`_. +Requests is released under terms of `Apache2 License`_. .. _`GPL Licensed`: http://www.opensource.org/licenses/gpl-license.php -.. _`The ISC License`: http://www.opensource.org/licenses/isc-license +.. _`Apache2 License`: http://opensource.org/licenses/Apache-2.0 Requests License diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 159d651a..31848b09 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -137,12 +137,13 @@ In case the JSON decoding fails, ``r.json`` simply returns ``None``. Raw Response Content -------------------- -In the rare case that you'd like to get the absolute raw socket response from the server, -you can access ``r.raw``:: +In the rare case that you'd like to get the raw socket response from the +server, you can access ``r.raw``. If you want to do this, make sure you set +``prefetch=False`` in your initial request. Once you do, you can do this:: + >>> r = requests.get('https:/github.com/timeline.json', prefetch=False) >>> r.raw - >>> r.raw.read(10) '\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03' diff --git a/requests/__init__.py b/requests/__init__.py index 70162ee7..8e5b6b0e 100644 --- a/requests/__init__.py +++ b/requests/__init__.py @@ -37,7 +37,7 @@ The other HTTP methods are supported - see `requests.api`. Full documentation is at . :copyright: (c) 2012 by Kenneth Reitz. -:license: ISC, see LICENSE for more details. +:license: Apache 2.0, see LICENSE for more details. """ @@ -45,7 +45,7 @@ __title__ = 'requests' __version__ = '0.14.2' __build__ = 0x001402 __author__ = 'Kenneth Reitz' -__license__ = 'ISC' +__license__ = 'Apache 2.0' __copyright__ = 'Copyright 2012 Kenneth Reitz' diff --git a/requests/api.py b/requests/api.py index 297f4cbf..cb64b69c 100644 --- a/requests/api.py +++ b/requests/api.py @@ -7,7 +7,7 @@ requests.api This module implements the Requests API. :copyright: (c) 2012 by Kenneth Reitz. -:license: ISC, see LICENSE for more details. +:license: Apache2, see LICENSE for more details. """ @@ -42,7 +42,7 @@ def request(method, url, **kwargs): adhoc_session = False session = kwargs.pop('session', None) if session is None: - session = sessions.session() + session = sessions.session(config=kwargs.get('config', None)) adhoc_session = True try: diff --git a/requests/defaults.py b/requests/defaults.py index 3662b0d6..a357e25a 100644 --- a/requests/defaults.py +++ b/requests/defaults.py @@ -43,3 +43,4 @@ defaults['keep_alive'] = True defaults['encode_uri'] = True defaults['trust_env'] = True defaults['store_cookies'] = True +defaults['support_http0.9'] = True diff --git a/requests/models.py b/requests/models.py index 045b3a58..9c768b5f 100644 --- a/requests/models.py +++ b/requests/models.py @@ -233,7 +233,7 @@ class Request(object): if r.status_code in REDIRECT_STATI and not self.redirect: - while (('location' in r.headers) and + while (('location' in r.headers and r.status_code in REDIRECT_STATI) and ((r.status_code is codes.see_other) or (self.allow_redirects))): r.content # Consume socket so it can be released @@ -700,6 +700,8 @@ class Response(object): self.headers = CaseInsensitiveDict() #: File-like object representation of response (for advanced usage). + #: Requires that ``prefetch=False` on the request. + # This requirement does not apply for use internally to Requests. self.raw = None #: Final URL location of Response. diff --git a/requests/sessions.py b/requests/sessions.py index cf0f8b9c..0c2de658 100644 --- a/requests/sessions.py +++ b/requests/sessions.py @@ -125,7 +125,8 @@ class Session(object): def init_poolmanager(self): self.poolmanager = PoolManager( num_pools=self.config.get('pool_connections'), - maxsize=self.config.get('pool_maxsize') + maxsize=self.config.get('pool_maxsize'), + strict=not self.config.get('support_http0.9') ) def __repr__(self): diff --git a/setup.py b/setup.py index 82ee8709..6c39182b 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ setup( 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Natural Language :: English', - 'License :: OSI Approved :: ISC License (ISCL)', + 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7',