-1

This is an example of my url which could be download instantly:

https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/61/MOD021KM/2022/152/MOD021KM.A2022152.1930.061.2022153073644.hdf

How can i download it? I already tried 'Requests', 'urllib' and 'hdf5' and nighder worked out. it's almost 71 mb but some of libraries like urllib download it with 11 kb!

Tried:

from urllib import request
URL = 'https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/61/MOD021KM/2022/152/MOD021KM.A2022152.1930.061.2022153073644.hdf'
local_filename, headers = urllib.request.urlretrieve(URL)

and

response = requests.get(url)

with h5py.File("local_file.hdf5", "w") as f:
    f.write(response.content)

But nighter worked out.

Yefet
  • 2,010
  • 1
  • 10
  • 19
  • See this link for help: https://stackoverflow.com/questions/16694907/download-large-file-in-python-with-requests. There are samples as to how to download data from a URL in chunks. – SoftwareDveloper Aug 21 '23 at 21:59

1 Answers1

0

It seems that you have to be logged in to get that file. I tried navigating with your URL and got login page: enter image description here

So, before downloading the file you have to log in.

elebur
  • 465
  • 1
  • 5