title: How to send urlencoded parameters in POST request in python
body: <p>I'm trying to deploy my production ready code to Heroku to test it. Unfortunately, it is not taking JSON data so we converted into x-www-form-urlencoded.</p>
  
  <pre><code>params = urllib.parse.quote_plus(json.dumps({
      'grant_type': 'X',
      'username': 'Y',
      'password': 'Z'
  }))
  r = requests.post(URL, data=params)
  print(params)
  </code></pre>
  
  <p>It is showing an error in this line as I guess <code>data=params</code> is not in proper format.</p>
  
  <p>Is there any way to POST the urlencoded parameters to an API?</p>