Improving your debugging skills
In this recipe, we will analyze and fix some bugs using a small script that replicates a call to an external service. We will show different techniques to improve your debugging skills.
The script will send some personal names to an internet server (httpbin.org, a test site) to get them back, simulating its retrieval from an external server. It will then split them into first and last names and prepare them to be sorted by surname. Finally, it will sort them.
We used this test site previously in the Interacting with forms recipe, Chapter 3, Building Your First Web Scraping Application. Note that the URL https://httpbin.org/forms/post renders the form, but internally calls the URL https://httpbin.org/post to send the information. We only need to use the second URL for this recipe..
The script contains several bugs that we will detect and fix.
Getting ready
For this recipe, we will use the requests
and parse
modules and...