i am trying to use Request to download lot of liks from NASA Data Access, but i am getting error code 401, probably because i could not made the authentication. Actually, i have a .netrc file that contains the code machine urs.earthdata.nasa.gov login <uid> password <password> but i don´t know how Google Colaboratory recognize and run the .netrc file that allow to download the files.
the code that i am trying to use is:
URL = rutas_GPM.iloc[i,0]
# Set the FILENAME string to the data file name, the LABEL keyword value, or any customized name.
FILENAME = 'GPM{0}.nc'.format(i)
result = requests.get(URL)
try:
result.raise_for_status()
f = open("/content/drive/MyDrive/Colab Notebooks/Prueba/"+FILENAME,'wb')
f.write(result.content)
f.close()
print('contents of URL written to '+FILENAME)
except:
print('requests.get() returned an error code '+str(result.status_code))
can you help me to solve this problem?
Thanks