How To Convert Curl Command To Requests
I need to retrieve data from a REST API. In the Centos shell I can do: curl -H 'ID:1234' -H 'Password:ABC' http://url.com/curl I am trying to do this with Requests in Python. On
Solution 1:
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)
Post a Comment for "How To Convert Curl Command To Requests"