Question
1. Modify the URL_reader.py program to use urllib instead of a socket. This code should still process the incoming data in chunks, and the size
1. Modify the URL_reader.py program to use urllib instead of a socket. This code should still process the incoming data in chunks, and the size of each chunk should be 512 characters. The idea is that to allow for the processing of very large files, which may be too large to fit into working memory. You cannot use a chunk (buffer) that grows beyond the 512 character limit! 3. Add code that prompts the user for the URL so it can read any web page. 4. Add error checking using try and except to handle the condition where the user enters an improperly formatted or non-existent URL. 5. Count the number of characters received, and stop displaying any text after it has shown exactly 3000 characters. Since your chunk size will not divide evenly into 3000, you will need to add some logic to ensure that exactly 3000 characters (no more, and no less) are displayed. 6. Continue to retrieve the entire document, count the total number of characters, and display (i.e., print) the total number of characters.
I need help with this in Python 2, I have the following code. It returns the word count of 167, so I need help with the bold items above in Python 2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started