title: pycurl: How to authenticate making a POST request
body: <p>Using the following command via cURL (Windows): <code>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
  </code> I am able to successfully post my data authenticated as per the <code>-u</code> switch.</p>
  
  <p>How can I successfully create the same POST request using pycurl?</p>
  
  <pre><code>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()
  </code></pre>
  
  <p>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.</p>
  
  <p>How can I successfully modify my code so that I can POST my data authenticated?</p>