Skip to content

Commit f641786

Browse files
adamtheturtleclaude
andcommitted
Map the ProjectHasNoApiAccess result code
Vuforia's result codes table spells this ``ProjectHasNoApiAccess``, while this package mapped only ``ProjectHasNoAPIAccess``, a spelling which came from a hand-written list in ``vws-python-mock`` rather than an observed response. No real response with either casing has been found, so both casings now map to ``ProjectHasNoAPIAccessError`` and the ambiguity is recorded in the code. ``vws-python-mock`` 2026.8.14 changes the mock to the documented spelling, so the pin is bumped to it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 06283ad commit f641786

4 files changed

Lines changed: 41 additions & 2 deletions

File tree

newsfragments/3128.change.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Map the ``ProjectHasNoApiAccess`` result code, as spelled in Vuforia's result codes table, to ``ProjectHasNoAPIAccessError``. The previously mapped ``ProjectHasNoAPIAccess`` casing still raises the same exception.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ optional-dependencies.dev = [
8686
"types-requests==2.33.0.20260712",
8787
"vale==3.13.0.0",
8888
"vulture==2.16",
89-
"vws-python-mock==2026.8.4.2",
89+
"vws-python-mock==2026.8.14",
9090
"vws-test-fixtures==2023.3.5",
9191
"yamlfix==1.19.1",
9292
"zizmor==1.29.0",

src/vws/exceptions/vws_exceptions.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ class ProjectSuspendedError(VWSError):
109109
@beartype
110110
class ProjectHasNoAPIAccessError(VWSError):
111111
"""Exception raised when Vuforia returns a response with a result code
112-
'ProjectHasNoAPIAccess'.
112+
'ProjectHasNoApiAccess'.
113+
114+
Vuforia's result codes table spells this result code
115+
'ProjectHasNoApiAccess', but no real response with either casing has
116+
been observed, so 'ProjectHasNoAPIAccess' raises this exception too.
113117
"""
114118

115119

@@ -241,7 +245,12 @@ class AuthorizationFailedError(VWSError):
241245
"InvalidTargetType": InvalidTargetTypeError,
242246
"LicenseCheckFailed": LicenseCheckFailedError,
243247
"MetadataTooLarge": MetadataTooLargeError,
248+
# Vuforia's result codes table spells this ``ProjectHasNoApiAccess``.
249+
# ``ProjectHasNoAPIAccess`` was mapped first, from a hand-written list
250+
# rather than an observed response. No real response with either
251+
# casing has been observed, so both are mapped.
244252
"ProjectHasNoAPIAccess": ProjectHasNoAPIAccessError,
253+
"ProjectHasNoApiAccess": ProjectHasNoAPIAccessError,
245254
"ProjectInactive": ProjectInactiveError,
246255
"ProjectSuspended": ProjectSuspendedError,
247256
"QuotaExceeded": QuotaExceededError,

tests/test_vws_exceptions.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,35 @@ def test_vwserror_from_result_code() -> None:
583583
assert exception.response is response
584584

585585

586+
@pytest.mark.parametrize(
587+
argnames="result_code",
588+
argvalues=["ProjectHasNoApiAccess", "ProjectHasNoAPIAccess"],
589+
)
590+
def test_project_has_no_api_access_casings(result_code: str) -> None:
591+
"""Both casings of the ``ProjectHasNoApiAccess`` result code map to
592+
``ProjectHasNoAPIAccessError``.
593+
594+
Vuforia's result codes table uses ``ProjectHasNoApiAccess``, but no
595+
real response with either casing has been observed.
596+
"""
597+
response = Response(
598+
text=f'{{"result_code":"{result_code}"}}',
599+
url="https://example.com/targets",
600+
status_code=HTTPStatus.FORBIDDEN,
601+
headers={},
602+
request_body=None,
603+
tell_position=0,
604+
content=b"",
605+
)
606+
607+
exception = VWSError.from_result_code(
608+
result_code=result_code,
609+
response=response,
610+
)
611+
612+
assert isinstance(exception, ProjectHasNoAPIAccessError)
613+
614+
586615
@pytest.mark.parametrize(
587616
argnames=("exception_type", "url"),
588617
argvalues=[

0 commit comments

Comments
 (0)