title: Make POST request using Python
body: <p>I am trying to make a POST request But getting this error : </p>
  
  <pre><code>Traceback (most recent call last):
    File "demo.py", line 7, in &lt;module&gt;
      r = requests.post(url, data=payload, headers=headers)
    File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 87, in post
      return request('post', url, data=data, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
      return session.request(method=method, url=url, **kwargs)
    File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 266, in request
      prep = req.prepare()
    File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 215, in prepare
      p.prepare_body(self.data, self.files)
    File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 338, in prepare_body
      body = self._encode_params(data)
    File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 74, in _encode_params
      for k, vs in to_key_val_list(data):
  ValueError: too many values to unpack
  </code></pre>
  
  <p>This is my program : </p>
  
  <pre><code>import requests
  
  url = 'http://www.n-gal.com/index.php?route=openstock/openstock/optionStatus'
  
  payload = {'var:1945,product_id:1126'}
  headers = {'content-type': 'application/x-www-form-urlencoded'}
  r = requests.post(url, data=payload, headers=headers)
  </code></pre>
  
  <p>I have tried the same POST request through Advanced rest client using following data :</p>
  
  <p><code>URL : http://www.n-gal.com/index.php?route=openstock/openstock/optionStatus</code>
  <code>payload : var=1945&amp;product_id=1126</code>
  <code>Content-Type: application/x-www-form-urlencoded</code></p>
  
  <p>And it is working fine can anyone  help me please...</p>