A simple, yet elegant, HTTP library.
  • Python 99.8%
  • Makefile 0.2%
Find a file
Ian Stapleton Cordasco 7104ad4b13
Some checks failed
CodeQL / Analyze (push) Failing after 2s
Tests / build (macOS-latest, 3.10) (push) Has been cancelled
Tests / build (macOS-latest, 3.11-dev) (push) Has been cancelled
Tests / build (macOS-latest, 3.7) (push) Has been cancelled
Tests / build (macOS-latest, 3.8) (push) Has been cancelled
Tests / build (macOS-latest, 3.9) (push) Has been cancelled
Tests / build (ubuntu-18.04, 3.10) (push) Has been cancelled
Tests / build (ubuntu-18.04, 3.11-dev) (push) Has been cancelled
Tests / build (ubuntu-18.04, 3.7) (push) Has been cancelled
Tests / build (ubuntu-18.04, 3.8) (push) Has been cancelled
Tests / build (ubuntu-18.04, 3.9) (push) Has been cancelled
Tests / build (windows-latest, 3.10) (push) Has been cancelled
Tests / build (windows-latest, 3.11-dev) (push) Has been cancelled
Tests / build (windows-latest, 3.7) (push) Has been cancelled
Tests / build (windows-latest, 3.8) (push) Has been cancelled
Tests / build (windows-latest, 3.9) (push) Has been cancelled
Tests / build (false, ubuntu-latest, pypy-3.7) (push) Has been cancelled
Lint code / lint (push) Has been cancelled
Merge pull request #6234 from jaap3/patch-1
Fix CURL_CA_BUNDLE override example
2022-09-09 14:10:14 -05:00
.github Add GitHub action to automate linting (#6157) 2022-06-08 13:11:11 -06:00
docs Fix CURL_CA_BUNDLE override example 2022-09-07 09:48:59 +02:00
ext The Principle of Polarity 2019-09-23 14:17:08 -04:00
requests Fixed warnings message to suggest using secure protocol. (#6188) 2022-06-29 12:41:49 -06:00
tests Add valdation for header name (#6154) 2022-06-08 12:03:56 -06:00
.coveragerc Add automatic code formatting to Requests (#6095) 2022-04-29 13:16:58 -06:00
.git-blame-ignore-revs Add .git-blame-ignore-revs 2022-04-29 15:39:22 -06:00
.gitignore Switch LGPL'd chardet for MIT licensed charset_normalizer (#5797) 2021-07-06 18:55:02 -05:00
.pre-commit-config.yaml Add automatic code formatting to Requests (#6095) 2022-04-29 13:16:58 -06:00
AUTHORS.rst Send only one Host header in chunked request 2021-09-02 00:53:08 -07:00
HISTORY.md v2.28.1 2022-06-29 09:09:11 -06:00
LICENSE Apply the Apache-2.0 license correctly 2020-08-27 09:44:27 -07:00
Makefile Remove Python 2 mention from tox (#6200) 2022-07-20 17:13:36 -06:00
MANIFEST.in Remove Pipfile/Pipfile.lock 2020-11-11 10:29:13 -08:00
NOTICE Apply the Apache-2.0 license correctly 2020-08-27 09:44:27 -07:00
pyproject.toml Add automatic code formatting to Requests (#6095) 2022-04-29 13:16:58 -06:00
README.md Farewell, sweet Concorde! 2022-03-25 10:50:33 -06:00
requirements-dev.txt Fix jinja 2022-02-18 18:33:43 -07:00
setup.cfg Allow charset normalizer >=2 and <3 (#6169) 2022-06-28 20:01:42 -06:00
setup.py Allow charset normalizer >=2 and <3 (#6169) 2022-06-28 20:01:42 -06:00
tox.ini Farewell, sweet Concorde! 2022-03-25 10:50:33 -06:00

Requests

Requests is a simple, yet elegant, HTTP library.

>>> import requests
>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))
>>> r.status_code
200
>>> r.headers['content-type']
'application/json; charset=utf8'
>>> r.encoding
'utf-8'
>>> r.text
'{"authenticated": true, ...'
>>> r.json()
{'authenticated': True, ...}

Requests allows you to send HTTP/1.1 requests extremely easily. Theres no need to manually add query strings to your URLs, or to form-encode your PUT & POST data — but nowadays, just use the json method!

Requests is one of the most downloaded Python packages today, pulling in around 30M downloads / week— according to GitHub, Requests is currently depended upon by 1,000,000+ repositories. You may certainly put your trust in this code.

Downloads Supported Versions Contributors

Installing Requests and Supported Versions

Requests is available on PyPI:

$ python -m pip install requests

Requests officially supports Python 3.7+.

Supported Features & BestPractices

Requests is ready for the demands of building robust and reliable HTTPspeaking applications, for the needs of today.

  • Keep-Alive & Connection Pooling
  • International Domains and URLs
  • Sessions with Cookie Persistence
  • Browser-style TLS/SSL Verification
  • Basic & Digest Authentication
  • Familiar dictlike Cookies
  • Automatic Content Decompression and Decoding
  • Multi-part File Uploads
  • SOCKS Proxy Support
  • Connection Timeouts
  • Streaming Downloads
  • Automatic honoring of .netrc
  • Chunked HTTP Requests

API Reference and User Guide available on Read the Docs

Read the Docs

Cloning the repository

When cloning the Requests repository, you may need to add the -c fetch.fsck.badTimezone=ignore flag to avoid an error about a bad commit (see this issue for more background):

git clone -c fetch.fsck.badTimezone=ignore https://github.com/psf/requests.git

You can also apply this setting to your global Git config:

git config --global fetch.fsck.badTimezone ignore

Kenneth Reitz Python Software Foundation