title: python http error 400
body: <p>i am trying to send http request but i always get http error 400</p>
  
  <p>what should I do?</p>
  
  <p>this is the code:</p>
  
  <pre><code>def login(params):
      url = "https://cps-inbararan.c9users.io/DBI/listener.php?func_name=%s&amp;params=%s"%("exists_user",json.dumps(params))
      ans = urllib2.urlopen(url).read()
      return ans.split("::")[0]
  </code></pre>
  
  <p>and this is the error</p>
  
  <pre><code>   Traceback (most recent call last):
  File "UMC_Handler.py", line 22, in &lt;module&gt;
    ans = uf.login(params)
  File "/home/ubuntu/workspace/UMC_func.py", line 60, in login
    ans = urllib2.urlopen(url).read()
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 410, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
  urllib2.HTTPError: HTTP Error 400: Bad request
  </code></pre>