This post will show you how to make your Python socket talk to an application on another web server.
Once you establish a connection with your socket, you can use Python to browse web data. The most common protocol is HTTP (HyperText Transport Protocol). HTTP is a set of rules to allow browsers to retrieve web documents from servers over the internet.
Examining the URL
Look at the URL in your location field or address bar of your web browser. It can be broken down into three parts.
For example, consider the URL http://dr-chuck.com/page1.htm.
- The first part is the “http”. This tells you what protocol is being used.
- The second part, “dr-chuck.com”, refers to the host you want to talk to.
- The last part, “page1.htm”, refers to the file you want to retrieve.
Every time you click on a link to get a new page on the internet, your browser initiates a request / response cycle to GET the new page. This, in a nutshell, is the act of surfing the web.