-
Notifications
You must be signed in to change notification settings - Fork 181
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
Replace HTTP.download #273
Conversation
Fixed it, I think |
So this is failing on 0.6, because of usign the new |
Codecov Report
@@ Coverage Diff @@
## master #273 +/- ##
===========================================
+ Coverage 71.84% 91.01% +19.17%
===========================================
Files 35 30 -5
Lines 1964 1258 -706
===========================================
- Hits 1411 1145 -266
+ Misses 553 113 -440
Continue to review full report at Codecov.
|
Demo of use (with OhMyLog.jl) |
Regarding 0.6 compatibility. I would just hold of merging this until we update See comment here: #264 (comment)
|
Fair, I am curious what it would take for 0.6 compat so I just made a commit (also I want to retrigger 0.7 CI which is being flaky). |
While I remember: this should take a headers argument. |
Very nice demo; It'd be nice if the numbers could be pretty-printed so they were easier to glance at and grok. W/ regards to headers, it'd be nice if this basically matched some of the convenience methods like Otherwise, I don't have a super strong preference for 0.6 vs. 0.7; if it works on 0.6, I'm happy to merge. I think we'll do one more release supporting both and then will go 0.7 only. |
Ahhhh, Consider that it lets the file set its own filepath.
So I think we need to blacklist any filepath that starts with a |
As a double-check, how about adding an assertion that the resulting path is actually under the download directory. path = joinpath(download_dir, file_path)
@assert startswith(normpath(path), normpath(download_dir)) |
Ah, I didn't realize that On the other hand, |
I'm a little confused. I would expect something like |
It does. But the question is what does a specific location mean?
|
Why allow the case where the filename is located in the header? It would be reasonable, I think, to reject the download if the filename is not in the url :thinking_face: |
There are a lot of files I want to download (millions) |
Should this also accept headers? |
Yes, it should. See also #273 (comment) |
@oxinabox, what's the status here? ready to review? still things you want to cleanup? just let me know. I'm going to target one final 0.6 release in the next few days and then we can rip out all the 0.6 compat stuff. |
I want to add everything you suggested in It won't take much to finish that off |
Right, added headers and kwargs. I've not added human units, as I am of many minds and bikesheds over that. So this is ready for review, I hope. The compat stuff can be stripped out, though I am not sure the best way to do that right now. |
Ok, this is all rebased for 0.7/1.0 |
Assuming windows passes, I am done with this now. |
Bump |
- any additional keyword args (`kw...`) are passed on to the HTTP request. | ||
""" | ||
function download(url::AbstractString, local_path=nothing, headers=Header[]; update_period=1, kw...) | ||
format_progress(x) = "$(round(100x, digits=2))%" |
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.
Possibly this should not be formatted.
idk what Juno is doing with progress
.
OhMyLog doesn't mind if it is given a string or a float.
But something else doing progress bars might like it to be a float.
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.
This looks great @oxinabox ! Thanks for doing this.
Can we have a release tagged? |
rather than deleting it as in #271
this replace it with a new and better version.
It is very verbose, but I think the 0.7 way of handling that is to tell your logger to be quieter.
Also to tell your logger to display a progress bar instead, that should be possible with the new system.
Locally this was working when I had it as a separate package but it is screwing up now that I've merge it in and I'm at a lose as to why.