- Parent Category: Programming Assignments' Solutions
We Helped With This Python Programming Assignment: Have A Similar One?
|More Info||Help With Python Homework|
Short Assignment Requirements
In this project, you will modify your webpage downloader program in Project 2 by supporting multithreading. Currently, the program makes one request at a time. Modify the program to implement a multithreaded webpage downloader capable of receiving multiple objects simultaneously. You will then conduct thoughtful and detailed experiments to compare the performance of this multithreaded webpage downloader with the basic webpage downloader in Project 2.
You will first need to read carefully and understand the technical details, specification, and the examples of multithreading at https://docs.python.org/2/library/threading.html. The following tutorial will be helpful: http://www.tutorialspoint.com/python/python_multithreading.htm.
(50 Points) Now, enhance your webpage downloader in Project 2 by supporting multithreading. Your new webpage downloader must have ALL required features of that in Project 2.
(50 Points) Conduct thoughtful and detailed experiments to compare the performance of this multi-threaded webpage downloader with that you developed in Project 2. You must decide on the proper performance metric to use, the type of experiments to be conducted, and how to conduct these experiments to quantitatively and adequately compare the performance of the two downloaders. In the report, you must specify your performance evaluation methodology, include the results in both well-formatted and presented tables and graphs, and briefly analyze the results.
What to Submit
You must submit the complete python code.
You must also submit a detailed report in pdf format, including a copy of the source code, testing procedure used to verify the correctness of the program, the screenshots and their explanations, performance evaluation methodology, comparative results, and their analysis. You must provide thoughtful screenshots to prove that your code works as expected. You must also demonstrate by the screenshots that the multithreading aspect works. You may want to introduce intentional time delays in the program in certain cases. Be creative!
Webpage Downloader Assignment-2(partially done):
Develop a webpage downloader program in Python. The program receives a URL pointing to a base HTML file
as a command line argument, and then downloads this base file as well as all
image objects referenced by that file. There is no need to download videos.
from HTMLParser import HTMLParser
# Set up a TCP/IP socket
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
'''Connect as client to a selected server
on a specified port'''
warning_ = """Type a URL, don't put any http:// or https://
infront of the url, must put a / at the end of the address: """
url_ = raw_input(warning_) # User will provide the URL appropriately
server_ = str(url_).split('/') # Isolating the server from the given URL
print server_ # Printing the server name
s.connect((server_, 80)) # Establishing connection using socket
page_ = url_.replace(server_, "")
# Protocol exchange - sends and receives
s.send("GET "+page_+" HTTP/1.0") # Using GET method to request information via HTTP
file_ = open('webpage.html','w') # Creating a blank html file
picture = "";
resp = s.recv(4096)
if resp == "": break
file_.write(resp) # Writing on the html file with webpage data
picture = picture + resp
def handle_starttag(self, tag, attrs):
print(dict(attrs)["src"]) # Printing the link of all image objects associated with the webpage
# Close the connection when completed