How it works...

requests directly accepts to send data in the proper way. By default, it sends the POST data in the application/x-www-form-urlencoded format.

Compare that with the  Accessing web APIs  recipe, where the data is explicitly sent in JSON format using the argument json . This makes the Content-Type be application/json instead of application/x-www-form-urlencoded .

The key aspect here is to respect the format of the form and the possible values that can return an error if incorrect, typically a 400 error.