Requests automatically decompresses gzip-encoded responses, and does
it's best to decodes response content to unicode when possible.
-You can get direct access to the raw reasponse (and even the socket),
+You can get direct access to the raw response (and even the socket),
if needed as well.
any other HTTP Header.
-
Why not Httplib2?
-----------------
Follow `@kennethreitz <https://twitter.com/kennethreitz>`_ for updates.
-
Mailing List
------------
You can assign a hook function on a per-request basis by passing a
``{hook_name: callback_function}`` dictionary to the ``hooks`` request
-paramaeter::
+parameter::
hooks=dict(args=print_url)
>>> requests.settings.verbose = sys.stderr
>>> requests.get('http://httpbin.org/headers')
2011-08-17T03:04:23.380175 GET http://httpbin.org/headers
- <Response [200]>
\ No newline at end of file
+ <Response [200]>
Installation
============
-This part of the documentation covers the installation of Requests. The first step to using any software package is getting it properly installed.
+This part of the documentation covers the installation of Requests.
+The first step to using any software package is getting it properly installed.
Distribute & Pip
Cheeseshop Mirror
-----------------
-If the Cheeseshop is down, you can also install Requests from Kenneth Reitz's personal `Cheeseshop mirror <http://pip.kreitz.co/>`_::
+If the Cheeseshop is down, you can also install Requests from Kenneth Reitz's
+personal `Cheeseshop mirror <http://pip.kreitz.co/>`_::
$ pip install -i http://pip.kreitz.co/simple requests
$ curl -O https://github.com/kennethreitz/requests/zipball/master
-Once you have a copy of the source, you can embed it in your Python package, or install it into your site-packages easily::
+Once you have a copy of the source, you can embed it in your Python package,
+or install it into your site-packages easily::
$ python setup.py install
ISC License
-----------
+A large number of open source projects you find today are `GPL Licensed`_.
+While the GPL has its time and place, it should most certainly not be your
+go-to license for your next open source project.
-A large number of open source projects you find today are `GPL Licensed`_. While the GPL has its time and place, it should most certainly not be your go-to license for your next open source project.
+A project that is released as GPL cannot be used in any commercial product
+without the product itself also being offered as open source.
-A project that is released as GPL cannot be used in any commercial product without the product itself also being offered as open source. 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.
+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`_.
* PyPy-c 1.5
-Support for Python 3.x is planned.
\ No newline at end of file
+Support for Python 3.x is planned.
.. module:: requests.models
-Eager to get started? This page gives a good introduction in how to get started with Requests. This assumes you already have Requests installed. If you do not, head over to the :ref:`Installation <install>` section.
+Eager to get started? This page gives a good introduction in how to get started
+with Requests. This assumes you already have Requests installed. If you do not,
+head over to the :ref:`Installation <install>` section.
First, make sure that:
r = requests.get('https://github.com/timeline.json')
-Now, we have a :class:`Response` object called ``r``. We can get all the information we need from this.
+Now, we have a :class:`Response` object called ``r``. We can get all the
+information we need from this.
Response Content
'content-type': 'application/json; charset=utf-8'
}
-The dictionary is special, though: it's made just for HTTP headers. According to `RFC 2616 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>`_, HTTP
+The dictionary is special, though: it's made just for HTTP headers. According to
+`RFC 2616 <http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html>`_, HTTP
Headers are case-insensitive.
So, we can access the headers using any capitalization we want::
>>> print r.cookies
{'requests-is': 'awesome'}
-The underlying CookieJar is also available for more advanced handing::
+The underlying CookieJar is also available for more advanced handling::
>>> r.request.cookiejar
<cookielib.CookieJar>