From the course: Complete Guide to Parallel and Concurrent Programming in Python

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Challenge: Download images in Python

Challenge: Download images in Python

(bright upbeat music) - [Instructor] For our third and final challenge problem, your goal will be to design and build a program to concurrently download a collection of image files from the internet and return the total number of bytes. We have 50 images hosted at the URL shown here, which you can use as the target files to download for this challenge. All of the JPEG files on that server are numbered sequentially from one to 50. To give you a starting point for this challenge, we've already implemented a sequential version of an image downloader in this example program. The sequential_download-images function on line 11 takes in a list of integers representing the image numbers to download. It simply uses a for loop to iterate through that list and passes each number to the download_image helper function, which downloads the corresponding file and then returns the number of bytes. The function accumulates those return values in the total bytes variable, and then returns the final…

Contents