Python Automation Cookbook
上QQ阅读APP看书,第一时间看更新

Getting ready

We'll work against the test server, https://httpbin.org/forms/post, which allows us to send a test form and sends back the submitted information.

The following is an example form to order a pizza:

You can fill the form manually and see it return the information in JSON format, including extra information such as the browser use.

The following is the frontend of the web form generated:

The following image is the back end of the web form generated:

We need to analyze the HTML to see the accepted data for the form. Checking the source code, it shows this:

Source code

Check the name of the inputs, custnamecusttel, custemail, size (a radio option), topping (a multiselection checkbox), delivery (time), and comments.