These are the homework assignment and what it is asking.
to prompt the user for the URL so it can read any web page. You can use split('/') to break the URL into its component parts so you can extract the host name for the socket connect call. Add error checking using try and except to handle the condition where the user enters an improperly formatted or non-existent URL the code only needs to accept 300 bytes from the URL page - in the code in 12.2 it would be len(data)to determine how much data was read. In the the while loop the mysock.recv only reads 128 bytes at a time
When putting a website in, it does print on what it has within that website,
I need something like this for my output:
HTTP/1.1 200 OK Date: Thu, 15 Apr 2021 20:46:29 GMT Server: Apache/2.4.18 (Ubuntu) Last-Modified: Sat, 13 May 2017 11:22:22 GMT ETag: "a7-54f6609245537" Accept-Ranges: bytes Content-Length: 167 Cache-Control: max-age=0, no-cache, no-store, must-revalidate Pragma: no-cache Expires: Wed, 11 Jan 1984 05:00:00 GMT Connection: close Content-Type: text/plain
But soft what light through yonder window breaks It is the east and Juliet is the sun Arise fair sun and kill the envious moon Who is already sick and pale with grief
Please help me