title: How should I fix the bad request response I am getting when sending a POST request?
body: <p>I am trying to log on a site using python (Requests) and keep getting 400 Bad request error.</p>
  
  <p>I have tried different header formats, even copied the headers from different browsers (Chrome, Edge, Firefox) but I am always getting 400 error.</p>
  
  <p>I've tried browsing around but can't find anything that would help me.</p>
  
  <pre><code>import requests
  
  with requests.Session() as c:
      url = 'https://developer.clashofclans.com/api/login'
      e='xxx@xxx.xxx'
      p='yyyyy'
  
      header = {'authority': 'developer.clashofclans.com',
                  'method': 'POST',
                  'path': '/api/login',
                  'scheme': 'https',
                  'accept': '*/*',
                  'accept-encoding': 'gzip, deflate, br',
                  'accept-language': 'en-IN,en-US;q=0.9,en;q=0.8',
                  'content-length': '57',
                  'content-type': 'application/json',
                  'cookie': 'cookieconsent_status=dismiss',
                  'origin': 'https://developer.clashofclans.com',
                  'referer': 'https://developer.clashofclans.com/',
                  'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36',
                  'x-requested-with': 'XMLHttpRequest'}
      login_data = dict(email=e,password=p)
      x = c.post(url,data=login_data,headers=header)
      print(x)
  </code></pre>