Comments (4)
Hi @tloredo. Thanks for opening this issue.
What Pooch is doing is downloading the HTML file that Dropbox gives you when you access to https://www.dropbox.com/s/5b9m1pq5qif5obf/lambda-3923-4010-phases-100.h5?dl=0. The Download button is not a regular anchor with a static link, but a dynamic button that triggers the download of the desired file.
After reading Dropbox's docs, you could force it to give you the download link by replacing the trailing dl=0
for dl=1
. I just try it out and it downloaded a binary file, which I suppose is the hd5 file you want to fetch.
I'm not sure how wget
is able to download the file, even if you pass the dl=0
. Maybe it parses the url and uses the one with dl=1
instead.
BTW, if you are going to pass custom urls for every file in the registry, you could use and empty string for your base_url
, since it won't be used at any point.
This should work:
import pooch
fetcher = pooch.create(
path=pooch.os_cache("SOAP2-1Spot"),
base_url="",
registry={
"lambda-3923-4010-phases-100.h5" : None,
"lambda-3923-6664-phases-4.h5" : None
},
# Now specify custom URLs for some of the files in the registry.
urls={
"lambda-3923-4010-phases-100.h5" : "https://www.dropbox.com/s/5b9m1pq5qif5obf/lambda-3923-4010-phases-100.h5?dl=1",
"lambda-3923-6664-phases-4.h5" : "https://www.dropbox.com/s/pyeapovhk4q6az0/lambda-3923-6664-phases-4.h5?dl=1"
},
)
# These paths end up pointing to files named as indicated, but containing HTML
# corresponding to a Dropbox "can't preview" response:
full_spec_path = fetcher.fetch("lambda-3923-6664-phases-4.h5")
ca_spec_path = fetcher.fetch("lambda-3923-4010-phases-100.h5")
from pooch.
@santisoler, thanks so much for the quick and helpful response (and the tip about the base url string)! dl=1
does solve this problem. I wonder what wget
is doing, but in any case this Pooch issue is solved.
from pooch.
Glad to be helpful! 🙂
from pooch.
Just a further followup: Some poking on Stack Exchange, after geting @santisoler's solution, suggests that Dropbox recognizes some user agents and handles requests from them in special ways. See, e.g., linux - how to download dropbox files using wget command? - Super User and curl - User-Agent affects Dropbox shared links download - Stack Overflow. The lesson being that having a Dropbox URL work with some user agents doesn't mean that URL will work for others.
from pooch.
Related Issues (20)
- DataVerse file DOIs in pooch.retrieve HOT 1
- Pooch 1.7.0 fails when filenames have apostrophes HOT 9
- Download from URL with expired SSL certificate HOT 4
- Add support for downloading from AWS S3 butckets HOT 1
- If Unzip/Untar fails because of a non-existent member, calling without members won't work HOT 2
- Feature: allow null hash in registry files HOT 3
- Make sure that any test that uses the network is properly marked HOT 1
- pooch.make_registry does not handle spaces in filenames correctly HOT 1
- `KeyError: 'key'` in ZenodoRepository.download_url() after Zenodo migration HOT 8
- Mention in docs that registry files must use POSIX compatible file names
- Release v1.8.0 HOT 1
- Sorry wrong repo for the issue HOT 1
- fatiando.org is down HOT 2
- Add "git blob hash" as available hash HOT 3
- Add or document support for Dryad via DOIDownloader HOT 1
- Add support for downloading from Azure cloud storage HOT 2
- Release v1.8.1 HOT 2
- Add support for downloading from Google Cloud Storage HOT 5
- Increase timeout on HTTP requests and use a variable HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pooch.