title: Curl POST request into pycurl code
body: <p>I'm trying to convert following curl request into pycurl:</p>
  
  <pre><code>curl -v
  -H Accept:application/json \
  -H Content-Type:application/json \
  -d "{
      name: 'abc',
      path: 'def',
      target: [ 'ghi' ]
  }" \
  -X POST http://some-url
  </code></pre>
  
  <p>I have following python code:</p>
  
  <pre><code>import pycurl, json
  
  c = pycurl.Curl()
  c.setopt(pycurl.URL, 'http://some-url')
  c.setopt(pycurl.HTTPHEADER, ['Accept: application/json'])
  data = json.dumps({"name": "abc", "path": "def", "target": "ghi"})
  c.setopt(pycurl.POST, 1)
  c.setopt(pycurl.POSTFIELDS, data)
  c.setopt(pycurl.VERBOSE, 1)
  c.perform()
  print curl_agent.getinfo(pycurl.RESPONSE_CODE)
  c.close()
  </code></pre>
  
  <p>Executing this I had an error 415: Unsupported media type, so I have changed:</p>
  
  <pre><code>c.setopt(pycurl.HTTPHEADER, ['Accept: application/json'])
  </code></pre>
  
  <p>into:</p>
  
  <pre><code>c.setopt(pycurl.HTTPHEADER, [ 'Content-Type: application/json' , 'Accept: application/json'])
  </code></pre>
  
  <p>This time I have 400: Bad request. But bash code with curl works. Do you have any idea what should I fix in python code?</p>