Using the following command via cURL (Windows): curl -u username:password "https://website.com/update/" --data "simChangesList=%5B%7B%22simId%22%3A760590802%2C%22changeType%22%3A2%2C%22targetValue%22%3A%22000307%22%2C%22effectiveDate%22%3Anull%7D%5D" --compressed
I am able to successfully post my data authenticated as per the -u
switch.
How can I successfully create the same POST request using pycurl?
import urllib
import pycurl
enc = urllib.quote('simChangesList:[{"simId":760590802,"changeType":2,"targetValue":000307,"effectiveDate":null}]')
c = pycurl.Curl()
c.setopt(c.URL, 'https://website.com/update/')
c.setopt(c.POSTFIELDS, enc)
c.setopt(c.VERBOSE, True)
c.perform()
c.close()
Executing the above code will not POST the data I am wanting it to do, and I suspect it's because I'm requiring authentication, as per the Windows cURL version.
How can I successfully modify my code so that I can POST my data authenticated?