Requests
来自维基百科,自由的百科全书
Requests是一个Python HTTP库,在Apache License 2.0 许可证下发行。这个项目的目标是使HTTP请求更简单,更人性化。Requests是没有默认包含在Python内的最流行的Python库之一[2],因此有人建议将其默认随Python一起发布[3]。
示例代码
>>> 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 - on
Seamless Wikipedia browsing. On steroids.