requests README

The project's README from github.com/psf/requests. As one markdown file: README.md.

Requests

Version Supported Versions Downloads Contributors Documentation

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. There’s 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 300M downloads / week — according to GitHub, Requests is currently depended upon by 4,000,000+ repositories.

Installing Requests and Supported Versions

Requests is available on PyPI:

$ python -m pip install requests

Requests officially supports Python 3.10+.

Supported Features & Best–Practices

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

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 timestamp (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

requests (psf/requests)

Searching Database…

54.5K ·GitHub
这是干什么的?它是一个简洁而优雅的 Python HTTP 库,让你能极其轻松地发送 HTTP/1.1 请求。
它是一个我在代码里导入的库,还是一个命令行工具?是一个库:安装后在你自己的 Python 代码中调用即可;README 里没有提到任何命令行界面。
我怎么把它加到项目里?用 pip install requests 从 PyPI 安装,然后在代码里导入它。
它支持哪些 Python 版本?Requests 官方支持 Python 3.10 及更新的版本。
它是用来写快速脚本,还是用来构建稳定的生产应用的?两者都适合——README 说它已经准备好满足构建稳健可靠的 HTTP 应用的各种要求。
除了最基本的请求,它还能帮我处理什么?Keep-alive 和连接池、带 Cookie 持久化的会话、浏览器风格的 TLS/SSL 证书校验、Basic 和 Digest 身份认证、SOCKS 代理支持、连接超时、流式下载、多部分文件上传,以及自动解压响应内容。
它用得有多广泛?它是目前下载量最大的 Python 包之一,每周大约有 3 亿次下载,GitHub 上有超过 4,000,000 个仓库依赖它。
Creator
psf
Size
13.3 MB
Stars
54.5K
Age
15y
Commits · 90 Days