requests 简单优雅HTTP请求库

requests简介

requests,Python的第三方的HTTP请求库,可以十分容易地发送HTTP/1.1请求,不需要手动向URL添加查询字符串,也不需要对PUT和POST数据进行形式编码,只需使用json方法!

requests应用实例

>>> 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 Github统计数据

Apache-2.0 license

Github 50.6k stars

requests安装命令

python -m pip install requests

requests Python版本要求

Python3.7+

免责声明:内容编辑自网络,仅供参考,不保证正确性,不作任何决策依据!!以上数据皆截止于博文的写稿日期。


行业导航 / Python指南 :
























Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.