I am working on a website that allows people to upload their images. It’s mainly just a learning experience, and I’m writing it in python. One thing it should be able to do is take a url where an image resides, then reupload that to its own server. So here’s the question:
One person gives my website a url, then my server starts downloading the image. While it is downloading that image, another request comes in. Is there any way to get the server to give a response (Like saying the server is busy) even when it’s doing something else? Is there a better way to go about this?
Thanks in advance!
I wrote up an example that I hope you find helpful. It consists of a
urls.txtfile that lists the jobs to process and a xdownloader.py file which downloads using multiple processes. I tested it on a Linux machine running Python 2.7.xdownloader.py
urls.txt
Running
python xdownloader.pyI get:You can see that the jobs are running asynchronously… Some jobs start earlier, but finish later than the others. (I’m looking at you news.google.com!) If this example doesn’t fit your needs, please let me know in the comments.