Skip to content

Commit

Permalink
Merge pull request #97 from winds-mobi/bugfix/aletsch-catch-404
Browse files Browse the repository at this point in the history
[aletsch] Catch transient 404 error
  • Loading branch information
ysavary authored Jul 6, 2024
2 parents 30ce7d0 + 74a753b commit 67ec690
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions providers/aletsch.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def __init__(self, path, name, lon, lat):

def parse(self, connect_timeout, read_timeout):
response = requests.get(self.url, timeout=(connect_timeout, read_timeout))
if response.status_code == 404:
raise ProviderException(f"Url '{self.url}' not found")
self._station = etree.fromstring(response.content).find("./station")

def name(self):
Expand Down Expand Up @@ -145,6 +147,8 @@ def __init__(self, path):

def parse(self, connect_timeout, read_timeout):
response = requests.get(self.url, timeout=(connect_timeout, read_timeout))
if response.status_code == 404:
raise ProviderException(f"Url '{self.url}' not found")
self._station = etree.fromstring(response.content)

def name(self):
Expand Down

0 comments on commit 67ec690

Please sign in to comment.