Skip to content

Commit

Permalink
timeout in function call
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry1 committed Aug 16, 2024
1 parent 673d80e commit 7469ef7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/valuefragments/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,12 @@ async def run_grouped_in_ppe(
def getselectedhreflinks(
thebaseurl: str = "https://www.goc-stuttgart.de/event-guide/ergebnisarchiv",
theselector: str = '//a/@href[contains(string(), "fileadmin/ergebnisse/2024")]',
thetimeout: int | tuple[int, int] = (5, 10),
) -> list[str]:
"""Parse HTML from URL for a-href matches by XPATH"""
# <https://devhints.io/xpath> <https://stackoverflow.com/q/78877951>
try:
thesourcehtml: requests.Response = requests.get(url=thebaseurl, timeout=(5, 10))
thesourcehtml: requests.Response = requests.get(url=thebaseurl, timeout=thetimeout)
except requests.exceptions.Timeout:
thelogger.error("timeout exception while fetching %s", thebaseurl)
# Connect Timeout 5s, 10s for transmission
Expand Down

0 comments on commit 7469ef7

Please sign in to comment.