Requests是一个Python HTTP,在Apache License 2.0 许可证下发行。这个项目的目标是使HTTP请求更简单,更人性化。Requests是没有默认包含在Python内的最流行的Python库之一[2],因此有人建议将其默认随Python一起发布[3]

Quick Facts 原作者, 开发者 ...
Requests
Thumb
原作者Kenneth Reitz
开发者Kenneth Reitz, Cory Benfield, Ian Stapleton Cordasco, Nate Prewitt
首次发布2011年2月14日 (2011-02-14)
当前版本2.25.1(2020年12月16日,​3年前​(2020-12-16[1]
源代码库 编辑维基数据链接
编程语言Python
操作系统跨平台
许可协议Apache许可证2.0
网站requests.readthedocs.io 编辑维基数据链接
Close

示例代码

>>> 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, ...}

引用

外部链接

Wikiwand in your browser!

Seamless Wikipedia browsing. On steroids.

Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.

Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.