I'm porting some automation scripts from bash to python, and they're almost ll curl commands of the following format:
curl -k -H "Content-Type: application/json" -X POST -d '{ "Request": {
"MessageID": "xxxx",
"MessageDateTime": "xxxxx",
"SourceSystem": "xxxx",
}
}' https://myUrl.xxx
What's the best way to structure this in Python accurately? So far I have:
import requests
headers = {'Content-Type': 'application/json'}
payload = {'All the data'}
conn = httplib.HTTPConnection("myUrl.xxx")
conn.request("POST", "", payload, headers)
response = conn.getresponse()
print response
I want to make sure the -k, -d, and -x bash options are being reflected in this script. Thank you!