How to perform HTTP requests with python - Part 1: The standard Library -


HTTP is the protocol used by the World Wide Web, that's why being able to interact with it programmatically is essential: scraping a web page, communicating with a service APIs, or even simply downloading a file, are all tasks based on this interaction. Python makes such operations very easy: some useful functions are already provided in the standard library, and for more complex tasks it's possible (and even recommended) to use the external requests module. In this first article of the series we will focus on the built-in modules. We will use python3 and mostly work inside the python interactive shell: the needed libraries will be imported only once to avoid repetitions.

This is a companion discussion topic for the original entry at