This recipe will use the socket library that comes with both MicroPython and Python to perform an HTTP request. We will create a function that receives a URL as its input and returns the response from the requested web server after performing the HTTP request. We will also create a function that can parse a URL and return the hostname and path components of the URL. These pieces will be needed to perform the HTTP request.
There's a whole class of MicroPython projects that will want to connect to web servers on the internet and fetch different results. You will see one way to do this using the socket library, which gives you direct access to TCP sockets to read and write bytes of data from them.