New to Python, mostly used R before. I am trying to download multiple files from a webpages API (climatic data), see link https://opendata-download-grid-archive.smhi.se/data/6/201604/MESAN_201604050000+000H00M
I want to download a file for each hour of every day of every month of every year (from 2008- 2019), that is changing the "201604050000" part to "201604050100", "201604050200", "201604050300", etc. Everything else looks the same, I only need to change the time/day/month/year to download a file.
This is my Python code for getting every file, but I feel lost in how to download it.
for a in [2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019]:
for b in [1,2,3,4,5,6,7,8,9,10,11,12]:
for c in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,
28,29,30,31]:
for d in ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11",
"12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"]:
s = "grib_%d_%d_%d_%s" %(a,b,c,d)
print(s)
How can I download all these files? I understand that it will fill my memory quite, so I am happy if I can start by downloading 24 files to start, which is one day. Anyone else has experienced this problem?
In the end, when I have managed my files, I also want to delete them (so I don't allocate too much memory).