title: Conversion of curl to Python Requests
body: <p>I'm trying to convert the following working request in curl to a python request (using <a href="https://requests.readthedocs.io/en/latest/" rel="nofollow noreferrer">Requests</a>).</p>
  <pre><code>curl --data 'query={&quot;tags&quot;:[&quot;test1&quot;,&quot;test2&quot;]}' http://www.test.com/match
  </code></pre>
  <p>(I've used a fake url but the command does work with the real url)</p>
  <p>The receiving end (ran in Flask) does this:</p>
  <pre><code>@app.route(&quot;/match&quot;, methods=['POST'])
  def tagmatch():
      query = json.loads(request.form['query'])
      tags = query.get('tags')
      # ... does stuff ...
      return json.dump(stuff)
  </code></pre>
  <p>In curl (7.30), ran on Mac OS X (10.9) the command above properly returns a JSON list that's filtered using the tag query.</p>
  <p>My Python script is as follows, it returns a 400 Bad Request error.</p>
  <pre><code>import requests
  
  payload = {&quot;tags&quot;:[&quot;test1&quot;, &quot;test2&quot;]}
  # also tried  payload = 'query={&quot;tags&quot;:[&quot;test1&quot;,&quot;test2&quot;]}'
  url = 'http://www.test.com/match'
  
  r = requests.post(url, data=payload)
  
  if __name__=='__main__':
       print(r.text)
  </code></pre>