README.rst 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Requests: HTTP for Humans
  2. =========================
  3. .. image:: https://badge.fury.io/py/requests.png
  4. :target: http://badge.fury.io/py/requests
  5. .. image:: https://travis-ci.org/kennethreitz/requests.png?branch=master
  6. :target: https://travis-ci.org/kennethreitz/requests
  7. .. image:: https://pypip.in/d/requests/badge.png
  8. :target: https://crate.io/packages/requests/
  9. Requests is an Apache2 Licensed HTTP library, written in Python, for human
  10. beings.
  11. Most existing Python modules for sending HTTP requests are extremely
  12. verbose and cumbersome. Python's builtin urllib2 module provides most of
  13. the HTTP capabilities you should need, but the api is thoroughly broken.
  14. It requires an enormous amount of work (even method overrides) to
  15. perform the simplest of tasks.
  16. Things shouldn't be this way. Not in Python.
  17. .. code-block:: pycon
  18. >>> r = requests.get('https://api.github.com', auth=('user', 'pass'))
  19. >>> r.status_code
  20. 204
  21. >>> r.headers['content-type']
  22. 'application/json'
  23. >>> r.text
  24. ...
  25. See `the same code, without Requests <https://gist.github.com/973705>`_.
  26. Requests allow you to send HTTP/1.1 requests. You can add headers, form data,
  27. multipart files, and parameters with simple Python dictionaries, and access the
  28. response data in the same way. It's powered by httplib and `urllib3
  29. <https://github.com/shazow/urllib3>`_, but it does all the hard work and crazy
  30. hacks for you.
  31. Features
  32. --------
  33. - International Domains and URLs
  34. - Keep-Alive & Connection Pooling
  35. - Sessions with Cookie Persistence
  36. - Browser-style SSL Verification
  37. - Basic/Digest Authentication
  38. - Elegant Key/Value Cookies
  39. - Automatic Decompression
  40. - Unicode Response Bodies
  41. - Multipart File Uploads
  42. - Connection Timeouts
  43. - Thread-safety
  44. - HTTP(S) proxy support
  45. Installation
  46. ------------
  47. To install Requests, simply:
  48. .. code-block:: bash
  49. $ pip install requests
  50. Or, if you absolutely must:
  51. .. code-block:: bash
  52. $ easy_install requests
  53. But, you really shouldn't do that.
  54. Documentation
  55. -------------
  56. Documentation is available at http://docs.python-requests.org/.
  57. Contribute
  58. ----------
  59. #. 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.
  60. #. 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.
  61. #. Fork `the repository`_ on GitHub to start making your changes to the **master** branch (or branch off of it).
  62. #. Write a test which shows that the bug was fixed or that the feature works as expected.
  63. #. Send a pull request and bug the maintainer until it gets merged and published. :) Make sure to add yourself to AUTHORS_.
  64. .. _`the repository`: http://github.com/kennethreitz/requests
  65. .. _AUTHORS: https://github.com/kennethreitz/requests/blob/master/AUTHORS.rst
  66. .. _Contributor Friendly: https://github.com/kennethreitz/requests/issues?direction=desc&labels=Contributor+Friendly&page=1&sort=updated&state=open