Skip to content
Myr

Merge pull request #1474 from Kwpolska/docfix

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

Some tiny fixes to the documentation

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 949a29c, 2ef782b · Browse files · 8 files+24 added−23 removed
This commit

State

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

Diff stats

8 files+24 added−23 removed

  • other:+24 added−23 removed

8 files+24 added−23 removed

modified:docs/dev/philosophy.rst+1 added-1 removed
36 unmodified lines
37~~~~~~~~~~~~~~~~~~~~~3839Distributions have been made for many Linux repositories, including: Ubuntu, Debian, RHEL, and Arch.4041These distributions are sometimes divergent forks, or are otherwise not kept up-to-date with the latest code and bugfixes. PyPI (and its mirrors) and GitHub are the official distribution sources; alternatives are not supported by the requests project.41These distributions are sometimes divergent forks, or are otherwise not kept up-to-date with the latest code and bugfixes. PyPI (and its mirrors) and GitHub are the official distribution sources; alternatives are not supported by the Requests project.
modified:docs/dev/todo.rst+2 added-2 removed
4 unmodified lines
56#. Check for open issues or open a fresh issue to start a discussion around a bug.7 There is a Contributor Friendly tag for issues that should be ideal for people who are not very8 familiar with the codebase yet.9#. Fork `the repository <https://github.com/kennethreitz/requests>`_ on Github and start making your9#. Fork `the repository <https://github.com/kennethreitz/requests>`_ on GitHub and start making your10 changes to a new branch.11#. Write a test which shows that the bug was fixed.12#. Send a pull request and bug the maintainer until it gets merged and published. :)13 Make sure to add yourself to `AUTHORS <https://github.com/kennethreitz/requests/blob/master/AUTHORS.rst>`_.
31 unmodified lines
45- PyPy 1.94647Support for Python 3.1 and 3.2 may be dropped at any time.4849Google App Engine will never be officially supported. Pull requests for compatibility will be accepted, as long as they don't complicate the codebase.49Google App Engine will never be officially supported. Pull Requests for compatibility will be accepted, as long as they don't complicate the codebase.505152Are you crazy?53--------------
7 unmodified lines
modified:docs/user/advanced.rst+4 added-4 removed
11 unmodified lines
12The Session object allows you to persist certain parameters across13requests. It also persists cookies across all requests made from the14Session instance.1516A session object has all the methods of the main Requests API.16A Session object has all the methods of the main Requests API.1718Let's persist some cookies across requests::1920 s = requests.Session()
5 unmodified lines
26 # '{"cookies": {"sessioncookie": "123456789"}}'272829Sessions can also be used to provide default data to the request methods. This30is done by providing data to the properties on a session object::30is done by providing data to the properties on a Session object::3132 s = requests.Session()33 s.auth = ('user', 'pass')34 s.headers.update({'x-test': 'true'})
15 unmodified lines
5051Whenever a call is made to requests.*() you are doing two major things. First,52you are constructing a ``Request`` object which will be sent off to a server53to request or query some resource. Second, a ``Response`` object is generated54once ``requests`` gets a response back from the server. The response object54once ``requests`` gets a response back from the server. The Response object55contains all of the information returned by the server and also contains the56``Request`` object you created originally. Here is a simple request to get some57very important information from Wikipedia's servers::58
60 unmodified lines
119120 >>> requests.get('https://kennethreitz.com', verify=True)121 requests.exceptions.SSLError: hostname 'kennethreitz.com' doesn't match either of '*.herokuapp.com', 'herokuapp.com'122123I don't have SSL setup on this domain, so it fails. Excellent. Github does though::123I don't have SSL setup on this domain, so it fails. Excellent. GitHub does though::124125 >>> requests.get('https://github.com', verify=True)126 <Response [200]>127
467 unmodified lines
modified:docs/user/authentication.rst+1 added-1 removed
85 unmodified lines
86- Kerberos_87- NTLM_8889If you want to use any of these forms of authentication, go straight to their90Github page and follow the instructions.90GitHub page and follow the instructions.919293New Forms of Authentication94---------------------------
20 unmodified lines
modified:docs/user/install.rst+5 added-5 removed
8 unmodified lines
910Distribute & Pip11----------------1213Installing requests is simple with `pip <http://www.pip-installer.org/>`_::13Installing Requests is simple with `pip <http://www.pip-installer.org/>`_::1415 $ pip install requests1617or, with `easy_install <http://pypi.python.org/pypi/setuptools>`_::
3 unmodified lines
21But, you really `shouldn't do that <http://www.pip-installer.org/en/latest/other-tools.html#pip-compared-to-easy-install>`_.22232425Cheeseshop Mirror26-----------------25Cheeseshop (PyPI) Mirror26------------------------2728If the Cheeseshop is down, you can also install Requests from one of the29mirrors. `Crate.io <http://crate.io>`_ is one of them::28If the Cheeseshop (a.k.a. PyPI) is down, you can also install Requests from one29of the mirrors. `Crate.io <http://crate.io>`_ is one of them::3031 $ pip install -i http://simple.crate.io/ requests3233
23 unmodified lines
modified:docs/user/quickstart.rst+8 added-7 removed
115 unmodified lines
116117The ``gzip`` and ``deflate`` transfer-encodings are automatically decoded for you.118119For example, to create an image from binary data returned by a request, you can120use the following code:120use the following code::121122 >>> from PIL import Image123 >>> from StringIO import StringIO124 >>> i = Image.open(StringIO(r.content))
47 unmodified lines
172More complicated POST requests173------------------------------174175Typically, you want to send some form-encoded data — much like an HTML form.176To do this, simply pass a dictionary to the `data` argument. Your176To do this, simply pass a dictionary to the ``data`` argument. Your177dictionary of data will automatically be form-encoded when the request is made::178179 >>> payload = {'key1': 'value1', 'key2': 'value2'}180 >>> r = requests.post("http://httpbin.org/post", data=payload)
161 unmodified lines
342Requests will automatically perform location redirection while using the GET343and OPTIONS verbs.344345GitHub redirects all HTTP requests to HTTPS. We can use the ``history`` method346of the Response object to track redirection. Let's see what Github does::346of the Response object to track redirection. Let's see what GitHub does::347348 >>> r = requests.get('http://github.com')349 >>> r.url350 'https://github.com/'
1 unmodified line
352 200353 >>> r.history354 [<Response [301]>]355356The :class:`Response.history` list contains a list of the357:class:`Request` objects that were created in order to complete the request. The list is sorted from the oldest to the most recent request.356The :class:`Response.history` list contains the :class:`Request` objects that357were created in order to complete the request. The list is sorted from the358oldest to the most recent request.359360If you're using GET or OPTIONS, you can disable redirection handling with the361``allow_redirects`` parameter::362
15 unmodified lines
378379Timeouts380--------381381You can tell requests to stop waiting for a response after a given number of382You can tell Requests to stop waiting for a response after a given number of383seconds with the ``timeout`` parameter::384385 >>> requests.get('http://github.com', timeout=0.001)386 Traceback (most recent call last):
2 unmodified lines
389390391.. admonition:: Note:392392 ``timeout`` only effects the connection process itself, not the393 ``timeout`` only affects the connection process itself, not the394 downloading of the response body.395396397Errors and Exceptions
20 unmodified lines
modified:docs/api.rst+1 added-1 removed
184 unmodified lines
185~~~~~~~~~186187One key difference that has nothing to do with the API is a change in the188license from the ISC_ license to the `Apache 2.0`_ license. The Apache 2.0189license ensures that contributions to requests are also covered by the Apache189license ensures that contributions to Requests are also covered by the Apache1902.0 license.191192.. _ISC: http://opensource.org/licenses/ISC193.. _Apache 2.0: http://opensource.org/licenses/Apache-2.0
1 unmodified line
modified:README.rst+2 added-2 removed
57 unmodified lines
5859Installation60------------6162To install requests, simply:62To install Requests, simply:6364.. code-block:: bash6566 $ pip install requests
16 unmodified lines
83Contribute84----------8586#. Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug. There is a Contributor Friendly tag for issues that should be ideal for people who are not very familiar with the codebase yet.87#. Fork `the repository`_ on Github to start making your changes to the **master** branch (or branch off of it).87#. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).88#. Write a test which shows that the bug was fixed or that the feature works as expected.89#. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.9091.. _`the repository`: http://github.com/kennethreitz/requests
1 unmodified line