From 2b7c183454d18ab3b134439e931c027be122ab4f Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Fri, 27 Dec 2024 18:59:01 +0100 Subject: [PATCH 1/2] Wrap whole request in try except (#611) * Wrap whole request in try except * Wrap whole request in try except * Wrap whole request in try except --- pytile/api.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/pytile/api.py b/pytile/api.py index 7b8b667..8c33231 100644 --- a/pytile/api.py +++ b/pytile/api.py @@ -81,18 +81,16 @@ async def _async_request( kwargs["headers"]["tile_app_version"] = DEFAULT_APP_VERSION kwargs["headers"]["tile_client_uuid"] = self.client_uuid - async with self._session.request( - method, f"{API_URL_SCAFFOLD}/{endpoint}", **kwargs - ) as resp: - try: + try: + async with self._session.request( + method, f"{API_URL_SCAFFOLD}/{endpoint}", **kwargs + ) as resp: resp.raise_for_status() data = await resp.json() - except ClientError as err: - if "401" in str(err): - raise InvalidAuthError("Invalid credentials") from err - raise RequestError( - f"Error requesting data from {endpoint}: {err}" - ) from err + except ClientError as err: + if "401" in str(err): + raise InvalidAuthError("Invalid credentials") from err + raise RequestError(f"Error requesting data from {endpoint}: {err}") from err LOGGER.debug("Data received from /%s: %s", endpoint, data) From f1084e91e0bf0d65f1f7007a279acfe8559ed40a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Dec 2024 11:02:30 -0700 Subject: [PATCH 2/2] build(deps-dev): bump pytest from 8.3.3 to 8.3.4 (#601) Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.3.3 to 8.3.4. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.3.3...8.3.4) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aaron Bach --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 11b802d..d2c1a1f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1109,13 +1109,13 @@ testutils = ["gitpython (>3)"] [[package]] name = "pytest" -version = "8.3.3" +version = "8.3.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2"}, - {file = "pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181"}, + {file = "pytest-8.3.4-py3-none-any.whl", hash = "sha256:50e16d954148559c9a74109af1eaf0c945ba2d8f30f0a3d3335edde19788b6f6"}, + {file = "pytest-8.3.4.tar.gz", hash = "sha256:965370d062bce11e73868e0335abac31b4d3de0e82f4007408d242b4f8610761"}, ] [package.dependencies]