title: POST request with form data
body: <p>I'm trying to simulate a request
  that has various headers and bracketed form data.</p>
  
  <p>Form Data:</p>
  
  <pre><code>{"username": "MY_USERNAME", "pass": "MY_PASS", "AUTO": "true"}
  </code></pre>
  
  <p>That is the form data shown in the console of Chrome
  So I tried putting it together with Python's <code>requests</code> library:</p>
  
  <pre><code>import requests
  reqUrl = 'http://website.com/login'
  postHeaders = {
      'Accept': '*/*',
      'Accept-Encoding': 'gzip,deflate',
      'Accept-Language': 'en-US,en;q=0.8',
      'Connection': 'keep-alive',
      'Content-Length': '68',
      'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
      'Host': 'website.com',
      'Origin': 'http://www.website.com',
      'Referer': 'http://www.website.com/',
      'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.120 Chrome/37.0.2062.120 Safari/537.36'
  }
  
  payload = {"username": "MY_USERNAME",
      "pass": "MY_PASS",
      "AUTO": "true"
  }
  
  session = requests.Session()
  response = session.post(reqUrl, data=payload, headers=postHeaders)
  </code></pre>
  
  <p>I'm receiving a response but it shows:</p>
  
  <pre><code>{"status":"failure","error":"Invalid request data"}
  </code></pre>
  
  <p>Am I going about implementing the form data wrong? I was also thinking it could have to do with modifying the <code>Content-Length</code>?</p>