python中requests.request()用法
method: 支持 GET, OPTIONS, HEAD, POST, PUT, PATCH, or DELETE.新建datas为字典,然后将字典转换为json。datas = json.dump(datas)data 为 json。
·
requests.request() 用法:
res = requests.request(method="post", url=url, data=datas, headers=headers)
1、method:
method: 支持 GET, OPTIONS, HEAD, POST, PUT, PATCH, or DELETE.
method="get"
method="post"
2、url:
url 为字符串
3、data
data 为 json 。
新建datas为字典,然后将字典转换为json。 datas = json.dump(datas)
datas["username"] = username
datas["password"] = password
headers = {
"Content-Type":"application/json",
}
datas = json.dumps(datas)
4、headers 为字典
headers = {
"Content-Type":"application/json",
"Accept-Encoding":"gzip, deflate, br"
}
更多资料:

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)