HTTP using urllib
Every time you open a website in your browser, you're using the Hypertext Transfer Protocol, or HTTP. HTTP was created over 30 years ago as a way for web browsers to download HTML documents, but has evolved into one of the most popular client-server communication protocols for any number of purposes.
Not only do we use it in the browser to view everything from plain text to streaming video across the internet, but applications can also use it to transfer data, initiate remote procedures, or distribute computing tasks.
HTTP transaction fundamentals
A basic HTTP transaction between a client and server goes like this:
- First, the client creates a request, which it will send to the server. The request contains the following:
- A URL, which specifies the host, port, and path to which the request is being made.
- A method, also known as a verb, which tells the server what operation the client is requesting. The most common methods...