Skip to content
Snippets Groups Projects
Commit b8651ff3 authored by Carsten Hinz's avatar Carsten Hinz
Browse files

added some error handling, to prevent deleting of variable file

parent ed44723b
No related branches found
No related tags found
2 merge requests!11Creation of first beta release version,!3fixed typo in standard name
...@@ -8,6 +8,7 @@ def updateTOARVariables(): ...@@ -8,6 +8,7 @@ def updateTOARVariables():
This overwrites the current static file This overwrites the current static file
""" """
response = requests.get("https://toar-data.fz-juelich.de/api/v2/variables/?limit=None") response = requests.get("https://toar-data.fz-juelich.de/api/v2/variables/?limit=None")
response.raise_for_status()#check, for errors.
varList = response.json() varList = response.json()
with open(TOAR_VARIABLES_METADATA_PATH, "w") as f: with open(TOAR_VARIABLES_METADATA_PATH, "w") as f:
json.dump(varList, f, indent=2) json.dump(varList, f, indent=2)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment