Skip to content

Commit

Permalink
Enable timeouts when getting soup
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Feb 15, 2024
1 parent 6702bfb commit 0ca092f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bioversions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def norm(s: str) -> str:
return s.lower().replace(" ", "").replace("-", "").replace(".", "")


def get_soup(url: str, verify: bool = True) -> BeautifulSoup:
def get_soup(url: str, verify: bool = True, timeout: Optional[int] = None) -> BeautifulSoup:
"""Get a beautiful soup parsed version of the given web page."""
res = requests.get(url, verify=verify)
res = requests.get(url, verify=verify, timeout=timeout or 3)
soup = BeautifulSoup(res.text, features="html.parser")
return soup

Expand Down

0 comments on commit 0ca092f

Please sign in to comment.