Skip to content

Commit

Permalink
Evolution retour d'erreurs (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelienC authored Sep 16, 2024
1 parent 802b850 commit e89b9c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion analyze_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def get_validata_report(resource_url):
params = {"url": resource_url, "schema": URL_SCHEMA}
validata_response = requests.get("https://api.validata.etalab.studio/validate", params=params)
validata_response.raise_for_status()
return validata_response.json()["report"]
try:
return validata_response.json()["report"]
except KeyError:
print(f"No metadatas from validata for: {resource_url}")


with open(FILENAME) as f:
Expand Down
5 changes: 4 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ def resource_is_valid(resource_url):
params = {"url": resource_url, "schema": URL_SCHEMA}
validata_response = requests.get("https://api.validata.etalab.studio/validate", params=params)
validata_response.raise_for_status()
return validata_response.json()["report"].get("valid")
try:
return validata_response.json()["report"].get("valid")
except KeyError:
return False


with open(FILENAME) as f:
Expand Down

0 comments on commit e89b9c6

Please sign in to comment.