mercredi 26 mai 2021

How to download certain files from online database path?

I have this url : https://satdat.ngdc.noaa.gov/sem/goes/data/avg/2017/07/goes13/csv/g13_epead_cpflux_5m_20170701_20170731.csv I need to browse through all the folders in the path (and for different 'goes' files (goes13, sometimes goes14, etc.) and ultimately download all files with the 'cpflux' phrase in it. the prefix and suffix could change from the .csv file above.

How do I set it up so that it goes through all the goes folders, and then downloads the *cpflux files onto my desktop?

I have tried:

url='https://satdat.ngdc.noaa.gov/sem/goes/data/avg/2017/07/goes13/csv/*cpflux*'

req = requests.get(url)
url_content = req.content
csv_file = open('test.csv', 'wb')
csv_file.write(url_content)
csv_file.close()

but the cpflux is giving an error since its 'not found' due to it being in the string.




Aucun commentaire:

Enregistrer un commentaire