March 2019
Beginner
490 pages
12h 40m
English
Typically, you want to send some form-encoded data. To do this, simply pass a dictionary to the data argument. Your data dictionary will automatically be form-encoded when the request is made. The requests library takes care of all the encoding and formatting for us.
In this example, we are going to simulate the sending of an HTML form through a POST request, just like browsers do when we send a form to a website. Form data is always sent in key-value dictionary format.
The request.post() function sends a request using the PUT method with the following syntax:
requests.post ('<URL>', data = <object>, json = <object type dict>)
You can find the following code in the form_post_method.py file:
import requestsdata_dictionary ...
Read now
Unlock full access