From 81231fa413a3190d9d054c23e2fa5bc755e5d808 Mon Sep 17 00:00:00 2001 From: konstantin Date: Sun, 12 Jan 2025 12:06:06 +0100 Subject: [PATCH] bump aiohttp from 3.9.5 to 3.11.11 (#266) --------- Co-authored-by: Konstantin --- requirements.txt | 14 +++++++++----- src/edi_energy_scraper/scraper.py | 4 +++- unittests/test_downloads.py | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9123447..a964ea8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,13 +4,15 @@ # # pip-compile pyproject.toml # -aiohttp==3.9.5 +aiohappyeyeballs==2.4.4 + # via aiohttp +aiohttp==3.11.11 # via edi_energy_scraper (pyproject.toml) -aiosignal==1.3.1 +aiosignal==1.3.2 # via aiohttp annotated-types==0.7.0 # via pydantic -attrs==24.2.0 +attrs==24.3.0 # via aiohttp efoli==1.4.0 # via edi_energy_scraper (pyproject.toml) @@ -27,8 +29,10 @@ multidict==6.1.0 # aiohttp # yarl propcache==0.2.1 - # via yarl -pydantic==2.10.4 + # via + # aiohttp + # yarl +pydantic==2.10.5 # via edi_energy_scraper (pyproject.toml) pydantic-core==2.27.2 # via pydantic diff --git a/src/edi_energy_scraper/scraper.py b/src/edi_energy_scraper/scraper.py index 09217b7..ea74d61 100644 --- a/src/edi_energy_scraper/scraper.py +++ b/src/edi_energy_scraper/scraper.py @@ -6,6 +6,7 @@ from typing import Awaitable, Union import aiohttp +from aiohttp import ClientTimeout from efoli import get_edifact_format_version from more_itertools import chunked @@ -40,12 +41,13 @@ def __init__( self._root_dir = path_to_mirror_directory self.tcp_connector = aiohttp.TCPConnector(limit_per_host=connection_limit) self._session = aiohttp.ClientSession(connector=self.tcp_connector) + self._timeout = ClientTimeout(total=30.0) async def get_documents_overview(self) -> list[Document]: """ download meta information about all available documents """ - documents_response = await self._session.get(f"{self._root_url}/api/documents", timeout=5) + documents_response = await self._session.get(f"{self._root_url}/api/documents", timeout=self._timeout) response_body = await documents_response.json() response_model = ResponseModel.model_validate(response_body) return response_model.data diff --git a/unittests/test_downloads.py b/unittests/test_downloads.py index 91cea13..c6bce9f 100644 --- a/unittests/test_downloads.py +++ b/unittests/test_downloads.py @@ -64,7 +64,7 @@ async def test_download_file(tmp_path: Path) -> None: assert actual.suffix == ".pdf" -def test_cleanup(tmp_path: Path) -> None: +async def test_cleanup(tmp_path: Path) -> None: # test is async to avoid RuntimeError: no running event loop test_folder = tmp_path / "test" test_folder.mkdir() a_directory = test_folder / "adir"