title: Help with cURL in Python
body: <p>I have to POST a request to a server. In the API documentation of the website there is this example that uses cURL in PHP:</p>
  
  <pre><code>$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, 'http://api.website.com');
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, "request=$wrapper");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  ;
  $data = curl_exec($ch);
  curl_close($ch);
  </code></pre>
  
  <p>But my app is done using Python, so I tried to write something like that but this code doesn't work:</p>
  
  <pre><code>req = urllib2.Request(url, formatted)  
  response = urllib2.urlopen(req)  
  html = response.read()  
  print html+"\n\n"  
  </code></pre>
  
  <p>Can you help me write a working conversion of a PHP cURL program to Python?</p>
  
  <p>Thank you!!</p>