-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update download_checkmd5.py #560
Conversation
Created a new urlretrieve function that handles retrying if the connection drops. Fixes #559.
from urllib.request import urlretrieve | ||
except ImportError: | ||
from urllib import urlretrieve | ||
import urllib2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code must be Python 2 and 3 compatible. Please keep using the conditional import and make sure the rest of the code works with Python 3.
python3 compatibility (tested)
|
||
def http_error_206(self, req, fp, code, msg, hdrs): | ||
# 206 Partial Content Response | ||
r = urllib.addinfourl(fp, hdrs, req.get_full_url()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urllib
is not imported.
fixed some more problems pointed by dirk
I tried using the code from this pull request and ran into several issue. The first thing is that it currently fails the unit tests since it does not support file urls anymore. The second problem is that is assumes that the server provides the I can look into this but am not sure when I will find time to implement all this cleanly. |
Thanks for reviewing. I'll work on it tomorrow. |
I think I addressed all your comments. Please let me know if there is something wrong. |
The pull request if very lengthy and I tried to come up with a much conciser version of it. Please take a look at #575. It works fine for me (but I don't think that any of our download servers actually stops the download before it is complete). Can you please check it against the server which you had the original problem with to verify that it actually resumes the download correctly? |
Resolved by #575. |
Created a new urlretrieve function that handles retrying if the connection drops. Fixes #559.