且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将curl命令转换为请求

更新时间:2023-02-16 19:51:04

使用 -H 用于curl的句柄,您可以设置标题值.在请求中,您传递标头数据的方式与处理参数相同,但是您使用了不同的关键字.

With the -H handle for curl, you're setting header values. In requests, you pass header data the same way you do with the params but you use a different keyword.

headers = {'ID': '1234' , 'Password' : 'ABC' }
requests.get("http://url.com/curl", headers=headers)

从请求文档中查看自定义标题