From 0779112478864b6dacb7419e84883a3ebaae8c7f Mon Sep 17 00:00:00 2001 From: SorooshMani-NOAA Date: Thu, 7 Apr 2022 13:52:47 -0400 Subject: [PATCH] Raise error when http request fails --- stormevents/nhc/storms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stormevents/nhc/storms.py b/stormevents/nhc/storms.py index 99c62f3..9aaeba0 100644 --- a/stormevents/nhc/storms.py +++ b/stormevents/nhc/storms.py @@ -221,6 +221,8 @@ def nhc_storms_gis_archive(year: int = None) -> pandas.DataFrame: url = 'http://www.nhc.noaa.gov/gis/archive_wsurge.php' response = requests.get(url, params={'year': year}) + if not response.ok: + response.raise_for_status() soup = BeautifulSoup(response.content, features='html.parser') table = soup.find('table')