Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
Issue #1: add raise for bad status
Browse files Browse the repository at this point in the history
  • Loading branch information
RickBarretto committed May 21, 2022
1 parent df96c30 commit 9db113a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/fetch_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Fetch the OSV API"""

import requests
from requests.exceptions import HTTPError

from src.core.utils.osv_model import OsvModel, OsvUrl

Expand All @@ -12,5 +13,7 @@ def fetch_api(osv_model: OsvModel) -> dict:
osv_model = osv_model.get_data()

response = requests.post(osv_link, data=osv_model)
response.raise_for_status()
json = response.json()

return response.json()
return json

0 comments on commit 9db113a

Please sign in to comment.