Merge remote-tracking branch 'origin/master'

This commit is contained in:
Kenneth Reitz
2012-12-12 16:53:44 -05:00
10 changed files with 28 additions and 19 deletions
+8 -4
View File
@@ -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
+1 -1
View File
@@ -8,7 +8,7 @@ Requests: HTTP for Humans
Release v\ |version|. (:ref:`Installation <install>`)
Requests is an :ref:`ISC Licensed <isc>` HTTP library, written in Python, for human beings.
Requests is an :ref:`Apache2 Licensed <apache2>` 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**.
+4 -4
View File
@@ -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
+4 -3
View File
@@ -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
<requests.packages.urllib3.response.HTTPResponse object at 0x101194810>
>>> r.raw.read(10)
'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03'
+2 -2
View File
@@ -37,7 +37,7 @@ The other HTTP methods are supported - see `requests.api`. Full documentation
is at <http://python-requests.org>.
: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'
+2 -2
View File
@@ -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:
+1
View File
@@ -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
+3 -1
View File
@@ -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.
+2 -1
View File
@@ -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):
+1 -1
View File
@@ -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',