Skip to content

Commit

Permalink
Throw 404 when single requested date is missing APOD data
Browse files Browse the repository at this point in the history
  • Loading branch information
Taylor committed Jul 10, 2020
1 parent eadb8a7 commit 0bb3f67
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions application.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ def _get_json_for_date(input_date, use_concept_tags, thumbs):

# get data
data = _apod_handler(dt, use_concept_tags, use_default_today_date, thumbs)

# Handle case where no data is available
if not data:
return _abort(code=404, msg=f"No data available for date: {input_date}", usage=False)

data['service_version'] = SERVICE_VERSION

# return info as JSON
Expand Down

0 comments on commit 0bb3f67

Please sign in to comment.