1、python --- requests模块中文文档:http://2.python-requests.org/zh_CN/latest/index.html

2、先下载requests模块

import requests

url = 'http://api.nnzhp.cn/api/user/stu_info'

res = requests.get(url,{'stu_name':'xiaohei'})
#res = requests.request('get',)
print(res.json())  #只能接受json格式的响应体
print(res.text)  #响应体有xml、json、html格式,可以用response.text来接收
print(res.headers)
print(res.status_code)

 

3、还有requests.post方法,以及requests.request方法,用法大致相同

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2021-09-02
  • 2022-02-10
猜你喜欢
  • 2021-12-27
  • 2021-09-06
  • 2021-12-08
  • 2021-12-03
  • 2021-11-10
  • 2022-02-18
  • 2022-12-23
相关资源
相似解决方案