diff --git a/helpers/main.py b/helpers/main.py index 9684515..12220f2 100644 --- a/helpers/main.py +++ b/helpers/main.py @@ -59,8 +59,12 @@ async def get_player_headshot(player): ) try: - resp = requests.get(req_url, timeout=2).text - soup = BeautifulSoup(resp, "html.parser") + async with aiohttp.ClientSession() as session: + async with session.get( + req_url, timeout=aiohttp.ClientTimeout(total=2) + ) as resp: + text = await resp.text() + soup = BeautifulSoup(text, "html.parser") for item in soup.find_all("img"): if "headshot" in item["src"]: await db_patch(