Skip to content

Commit

Permalink
OF: handle Timeout errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbASF committed Sep 30, 2023
1 parent 588e3a9 commit a4eec66
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plugins/asfdata.py
Expand Up @@ -144,9 +144,12 @@ def add_logo(reference, part):
# the logo pattern includes a place to insert the project/podling key
logo = (parts[0].format(item.key_id))
# HEAD request
response = requests.head('https://www.apache.org/' + logo, timeout=REQUESTS_TIMEOUT)
if response.status_code != 200:
# logo not found - use the default logo
try:
response = requests.head('https://www.apache.org/' + logo, timeout=REQUESTS_TIMEOUT)
if response.status_code != 200:
# logo not found - use the default logo
logo = parts[1]
except requests.exceptions.Timeout:
logo = parts[1]
# save the logo path as an attribute
setattr(item, 'logo', logo)
Expand Down Expand Up @@ -530,7 +533,7 @@ def process_blog(feed, count, words, debug):
entries = entries[:count]
except xml.parsers.expat.ExpatError:
entries = []
except requests.exceptions.ConnectionError:
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout):
entries = []
v = [ ]
for entry in entries:
Expand Down

0 comments on commit a4eec66

Please sign in to comment.