From bcc4f866d1debdd529206672c684038af74f393d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 10:16:30 +0000 Subject: [PATCH 1/2] Bump vws-python-mock from 2025.2.21 to 2025.3.10 Bumps [vws-python-mock](https://github.com/VWS-Python/vws-python-mock) from 2025.2.21 to 2025.3.10. - [Release notes](https://github.com/VWS-Python/vws-python-mock/releases) - [Changelog](https://github.com/VWS-Python/vws-python-mock/blob/main/CHANGELOG.rst) - [Commits](https://github.com/VWS-Python/vws-python-mock/compare/2025.02.21...2025.03.10) --- updated-dependencies: - dependency-name: vws-python-mock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 19855a78..86d9b496 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ optional-dependencies.dev = [ "sybil==9.1.0", "types-requests==2.32.0.20250306", "vulture==2.14", - "vws-python-mock==2025.2.21", + "vws-python-mock==2025.3.10", "vws-test-fixtures==2023.3.5", "yamlfix==1.17.0", ] From 086563f1ce61f99973bab89d253bc4f30992b498 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Mon, 10 Mar 2025 10:30:54 +0000 Subject: [PATCH 2/2] Remove OopsAnErrorOccurredPossiblyBadName which matches error no longer found in Vuforia --- CHANGELOG.rst | 2 ++ src/vws/exceptions/custom_exceptions.py | 25 ------------------------- src/vws/vws.py | 17 ++--------------- tests/test_vws_exceptions.py | 8 ++++---- 4 files changed, 8 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b18bc5e4..e2c0eeaa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,8 @@ Changelog Next ---- +* Removed ``vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadName`` which now does not occur in VWS. + 2024.09.21 ------------ diff --git a/src/vws/exceptions/custom_exceptions.py b/src/vws/exceptions/custom_exceptions.py index 11d47a67..694e98c3 100644 --- a/src/vws/exceptions/custom_exceptions.py +++ b/src/vws/exceptions/custom_exceptions.py @@ -9,31 +9,6 @@ from vws.response import Response -@beartype -class OopsAnErrorOccurredPossiblyBadNameError(Exception): - """Exception raised when VWS returns an HTML page which says "Oops, an - error occurred". - - This has been seen to happen when the given name includes a bad - character. - """ - - def __init__(self, response: Response) -> None: - """ - Args: - response: The response returned by Vuforia. - """ - super().__init__(response.text) - self._response = response - - @property - def response(self) -> Response: - """ - The response returned by Vuforia which included this error. - """ - return self._response - - @beartype class RequestEntityTooLargeError(Exception): """ diff --git a/src/vws/vws.py b/src/vws/vws.py index f8776657..5dd7503d 100644 --- a/src/vws/vws.py +++ b/src/vws/vws.py @@ -16,7 +16,6 @@ from vws_auth_tools import authorization_header, rfc_1123_date from vws.exceptions.custom_exceptions import ( - OopsAnErrorOccurredPossiblyBadNameError, ServerError, TargetProcessingTimeoutError, ) @@ -178,12 +177,6 @@ def make_request( The response to the request made by `requests`. Raises: - ~vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadNameError: - Vuforia returns an HTML page with the text "Oops, an error - occurred". - - This has been seen to happen when the given name includes a bad - character. ~vws.exceptions.custom_exceptions.ServerError: There is an error with Vuforia's servers. ~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is @@ -202,9 +195,6 @@ def make_request( base_vws_url=self._base_vws_url, ) - if "Oops, an error occurred" in response.text: - raise OopsAnErrorOccurredPossiblyBadNameError(response=response) - if ( response.status_code == HTTPStatus.TOO_MANY_REQUESTS ): # pragma: no cover @@ -290,12 +280,9 @@ def add_target( inactive. ~vws.exceptions.vws_exceptions.RequestTimeTooSkewedError: There is an error with the time sent to Vuforia. - ~vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadNameError: - Vuforia returns an HTML page with the text "Oops, an error - occurred". This has been seen to happen when the given name - includes a bad character. ~vws.exceptions.custom_exceptions.ServerError: There is an error - with Vuforia's servers. + with Vuforia's servers. This has been seen to happen when the + given name includes a bad character. ~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is rate limiting access. """ diff --git a/tests/test_vws_exceptions.py b/tests/test_vws_exceptions.py index f9a7b8da..86da6604 100644 --- a/tests/test_vws_exceptions.py +++ b/tests/test_vws_exceptions.py @@ -15,7 +15,7 @@ from vws import VWS from vws.exceptions.base_exceptions import VWSError from vws.exceptions.custom_exceptions import ( - OopsAnErrorOccurredPossiblyBadNameError, + ServerError, ) from vws.exceptions.vws_exceptions import ( AuthenticationFailureError, @@ -71,13 +71,13 @@ def test_invalid_given_id(vws_client: VWS) -> None: def test_add_bad_name(vws_client: VWS, high_quality_image: io.BytesIO) -> None: """ - When a name with a bad character is given, an - ``OopsAnErrorOccurredPossiblyBadName`` exception is raised. + When a name with a bad character is given, a ``ServerError`` exception is + raised. """ max_char_value = 65535 bad_name = chr(max_char_value + 1) with pytest.raises( - expected_exception=OopsAnErrorOccurredPossiblyBadNameError + expected_exception=ServerError, ) as exc: vws_client.add_target( name=bad_name,