OLD | NEW |
(Empty) | |
| 1 Requests: HTTP for Humans |
| 2 ========================= |
| 3 |
| 4 |
| 5 .. image:: https://travis-ci.org/kennethreitz/requests.png?branch=master |
| 6 :target: https://travis-ci.org/kennethreitz/requests |
| 7 |
| 8 .. image:: https://pypip.in/d/requests/badge.png |
| 9 :target: https://crate.io/packages/requests/ |
| 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 |
| 56 |
| 57 Installation |
| 58 ------------ |
| 59 |
| 60 To install requests, simply: |
| 61 |
| 62 .. code-block:: bash |
| 63 |
| 64 $ pip install requests |
| 65 |
| 66 Or, if you absolutely must: |
| 67 |
| 68 .. code-block:: bash |
| 69 |
| 70 $ easy_install requests |
| 71 |
| 72 But, you really shouldn't do that. |
| 73 |
| 74 |
| 75 Documentation |
| 76 ------------- |
| 77 |
| 78 Documentation is available at http://docs.python-requests.org/. |
| 79 |
| 80 |
| 81 Contribute |
| 82 ---------- |
| 83 |
| 84 #. Check for open issues or open a fresh issue to start a discussion around a fe
ature 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. |
| 85 #. Fork `the repository`_ on Github to start making your changes to the **master
** branch (or branch off of it). |
| 86 #. Write a test which shows that the bug was fixed or that the feature works as
expected. |
| 87 #. Send a pull request and bug the maintainer until it gets merged and published
. :) Make sure to add yourself to AUTHORS_. |
| 88 |
| 89 .. _`the repository`: http://github.com/kennethreitz/requests |
| 90 .. _AUTHORS: https://github.com/kennethreitz/requests/blob/master/AUTHORS.rst |
OLD | NEW |