Skip to content

Commit

Permalink
Merge pull request #78 from OpenGeoscience/fix-ingest-use-case
Browse files Browse the repository at this point in the history
Prevent writing of file if request was not successful
  • Loading branch information
jjnesbitt authored Oct 1, 2024
2 parents 165009f + 882de66 commit 82dd93c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sample_data/ingest_use_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def ingest_file(file_info, index=0, dataset=None, chart=None):
file_location.parent.mkdir(parents=True, exist_ok=True)
with open(file_location, 'wb') as f:
r = requests.get(file_url)
r.raise_for_status()
f.write(r.content)

existing = FileItem.objects.filter(name=file_name)
Expand Down

0 comments on commit 82dd93c

Please sign in to comment.