v2.2.1
[platform/upstream/python-requests.git] / README.rst
1 Requests: HTTP for Humans
2 =========================
3
4 .. image:: https://badge.fury.io/py/requests.png
5     :target: http://badge.fury.io/py/requests
6
7 .. image:: https://pypip.in/d/requests/badge.png
8         :target: https://crate.io/packages/requests/
9
10
11 Requests is an Apache2 Licensed HTTP library, written in Python, for human
12 beings.
13
14 Most existing Python modules for sending HTTP requests are extremely
15 verbose and cumbersome. Python's builtin urllib2 module provides most of
16 the HTTP capabilities you should need, but the api is thoroughly broken.
17 It requires an enormous amount of work (even method overrides) to
18 perform the simplest of tasks.
19
20 Things shouldn't be this way. Not in Python.
21
22 .. code-block:: pycon
23
24     >>> r = requests.get('https://api.github.com', auth=('user', 'pass'))
25     >>> r.status_code
26     204
27     >>> r.headers['content-type']
28     'application/json'
29     >>> r.text
30     ...
31
32 See `the same code, without Requests <https://gist.github.com/973705>`_.
33
34 Requests allow you to send HTTP/1.1 requests. You can add headers, form data,
35 multipart files, and parameters with simple Python dictionaries, and access the
36 response data in the same way. It's powered by httplib and `urllib3
37 <https://github.com/shazow/urllib3>`_, but it does all the hard work and crazy
38 hacks for you.
39
40
41 Features
42 --------
43
44 - International Domains and URLs
45 - Keep-Alive & Connection Pooling
46 - Sessions with Cookie Persistence
47 - Browser-style SSL Verification
48 - Basic/Digest Authentication
49 - Elegant Key/Value Cookies
50 - Automatic Decompression
51 - Unicode Response Bodies
52 - Multipart File Uploads
53 - Connection Timeouts
54 - Thread-safety
55 - HTTP(S) proxy support
56
57
58 Installation
59 ------------
60
61 To install Requests, simply:
62
63 .. code-block:: bash
64
65     $ pip install requests
66
67 Or, if you absolutely must:
68
69 .. code-block:: bash
70
71     $ easy_install requests
72
73 But, you really shouldn't do that.
74
75
76 Documentation
77 -------------
78
79 Documentation is available at http://docs.python-requests.org/.
80
81
82 Contribute
83 ----------
84
85 #. 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.
86 #. If you feel uncomfortable or uncertain about an issue or your changes, feel free to email @sigmavirus24 and he will happily help you via email, Skype, remote pairing or whatever you are comfortable with.
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_.
90
91 .. _`the repository`: http://github.com/kennethreitz/requests
92 .. _AUTHORS: https://github.com/kennethreitz/requests/blob/master/AUTHORS.rst
93 .. _Contributor Friendly: https://github.com/kennethreitz/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open