title: Using requests to POST to pastebin API
body: <p>I simply cannot get this to work.</p>
  
  <pre><code>header = {"Content-Type": "application/json; charset=utf8"}
  params = {"api_dev_key": dev_key, "api_user_name": username, "api_user_password": password}
  req = requests.post("http://pastebin.com/api/api_login.php", params = json.dumps(params), headers = header)
  print(req.status_code, req.reason, req.text)
  </code></pre>
  
  <p>The variables (my credentials) are just strings.
  The response I get: </p>
  
  <blockquote>
    <p>(200, 'OK', u'Bad API request, invalid api_dev_key')</p>
  </blockquote>
  
  <p>There's nothing wrong with the key, this POST works fine when I use <a href="https://www.hurl.it" rel="nofollow">https://www.hurl.it</a></p>