'How to convert Curl to Python request code?
I want to make a curl to python converter.
curl -X POST -H "data1:value1" -H "data2:value2" -d "{"datapart1":"random1","datapart2":"random2"}" "https://example.com"'
And i want to convert:
import requests
url = 'https://example.com'
data = '{"datapart1":"random1","datapart2":"random2"}'
headers = {'data1': 'value1', 'data2': 'value2'}
r = requests.post(url, data=data, headers=headers)
print(r.text)
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ShuXiaokai |
