vws-python 2026.2.25__tar.gz → 2026.2.25.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/CHANGELOG.rst +4 -0
- {vws_python-2026.2.25/src/vws_python.egg-info → vws_python-2026.2.25.1}/PKG-INFO +1 -1
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/async_query.py +2 -26
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/async_vws.py +3 -61
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/query.py +2 -26
- vws_python-2026.2.25.1/src/vws/reports.py +188 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/vws.py +3 -41
- {vws_python-2026.2.25 → vws_python-2026.2.25.1/src/vws_python.egg-info}/PKG-INFO +1 -1
- vws_python-2026.2.25/src/vws/reports.py +0 -117
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.git_archival.txt +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.gitattributes +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.github/dependabot.yml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.github/workflows/ci.yml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.github/workflows/dependabot-merge.yml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.github/workflows/lint.yml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.github/workflows/publish-site.yml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.github/workflows/release.yml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.gitignore +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.pre-commit-config.yaml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.prettierrc +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.vscode/extensions.json +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/.vscode/settings.json +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/CODE_OF_CONDUCT.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/LICENSE +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/README.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/conftest.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/__init__.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/api-reference.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/changelog.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/conf.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/contributing.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/exceptions.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/index.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/docs/source/release-process.rst +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/pyproject.toml +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/setup.cfg +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/spelling_private_dict.txt +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/__init__.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/_async_vws_request.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/_image_utils.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/_vws_request.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/async_vumark_service.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/exceptions/__init__.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/exceptions/base_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/exceptions/cloud_reco_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/exceptions/custom_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/exceptions/vws_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/include_target_data.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/py.typed +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/response.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/transports.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/vumark_accept.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws/vumark_service.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws_python.egg-info/SOURCES.txt +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws_python.egg-info/dependency_links.txt +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws_python.egg-info/not-zip-safe +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws_python.egg-info/requires.txt +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws_python.egg-info/top_level.txt +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/__init__.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/conftest.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_async_cloud_reco_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_async_query.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_async_vws.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_async_vws_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_cloud_reco_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_query.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_transports.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_vws.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/tests/test_vws_exceptions.py +0 -0
- {vws_python-2026.2.25 → vws_python-2026.2.25.1}/zizmor.yml +0 -0
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Web APIs.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
import datetime
|
|
6
5
|
import json
|
|
7
6
|
from http import HTTPMethod, HTTPStatus
|
|
8
7
|
from typing import Any, Self
|
|
@@ -25,7 +24,7 @@ from vws.exceptions.custom_exceptions import (
|
|
|
25
24
|
ServerError,
|
|
26
25
|
)
|
|
27
26
|
from vws.include_target_data import CloudRecoIncludeTargetData
|
|
28
|
-
from vws.reports import QueryResult
|
|
27
|
+
from vws.reports import QueryResult
|
|
29
28
|
from vws.transports import AsyncHTTPXTransport, AsyncTransport
|
|
30
29
|
|
|
31
30
|
|
|
@@ -197,30 +196,7 @@ class AsyncCloudRecoService:
|
|
|
197
196
|
}[result_code]
|
|
198
197
|
raise exception(response=response)
|
|
199
198
|
|
|
200
|
-
result: list[QueryResult] = []
|
|
201
199
|
result_list = list(
|
|
202
200
|
json.loads(s=response.text)["results"],
|
|
203
201
|
)
|
|
204
|
-
for item in result_list:
|
|
205
|
-
target_data: TargetData | None = None
|
|
206
|
-
if "target_data" in item:
|
|
207
|
-
target_data_dict = item["target_data"]
|
|
208
|
-
metadata = target_data_dict["application_metadata"]
|
|
209
|
-
timestamp_string = target_data_dict["target_timestamp"]
|
|
210
|
-
target_timestamp = datetime.datetime.fromtimestamp(
|
|
211
|
-
timestamp=timestamp_string,
|
|
212
|
-
tz=datetime.UTC,
|
|
213
|
-
)
|
|
214
|
-
target_data = TargetData(
|
|
215
|
-
name=target_data_dict["name"],
|
|
216
|
-
application_metadata=metadata,
|
|
217
|
-
target_timestamp=target_timestamp,
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
query_result = QueryResult(
|
|
221
|
-
target_id=item["target_id"],
|
|
222
|
-
target_data=target_data,
|
|
223
|
-
)
|
|
224
|
-
|
|
225
|
-
result.append(query_result)
|
|
226
|
-
return result
|
|
202
|
+
return [QueryResult.from_response_dict(item) for item in result_list] # type: ignore[misc]
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import base64
|
|
5
5
|
import json
|
|
6
|
-
from datetime import date
|
|
7
6
|
from http import HTTPMethod, HTTPStatus
|
|
8
7
|
from typing import Self
|
|
9
8
|
|
|
@@ -38,7 +37,6 @@ from vws.exceptions.vws_exceptions import (
|
|
|
38
37
|
)
|
|
39
38
|
from vws.reports import (
|
|
40
39
|
DatabaseSummaryReport,
|
|
41
|
-
TargetRecord,
|
|
42
40
|
TargetStatusAndRecord,
|
|
43
41
|
TargetStatuses,
|
|
44
42
|
TargetSummaryReport,
|
|
@@ -298,20 +296,7 @@ class AsyncVWS:
|
|
|
298
296
|
)
|
|
299
297
|
|
|
300
298
|
result_data = json.loads(s=response.text)
|
|
301
|
-
|
|
302
|
-
target_record_dict = dict(result_data["target_record"])
|
|
303
|
-
target_record = TargetRecord(
|
|
304
|
-
target_id=target_record_dict["target_id"],
|
|
305
|
-
active_flag=bool(target_record_dict["active_flag"]),
|
|
306
|
-
name=target_record_dict["name"],
|
|
307
|
-
width=float(target_record_dict["width"]),
|
|
308
|
-
tracking_rating=int(target_record_dict["tracking_rating"]),
|
|
309
|
-
reco_rating=target_record_dict["reco_rating"],
|
|
310
|
-
)
|
|
311
|
-
return TargetStatusAndRecord(
|
|
312
|
-
status=status,
|
|
313
|
-
target_record=target_record,
|
|
314
|
-
)
|
|
299
|
+
return TargetStatusAndRecord.from_response_dict(result_data) # type: ignore[misc]
|
|
315
300
|
|
|
316
301
|
async def wait_for_target_processed(
|
|
317
302
|
self,
|
|
@@ -446,27 +431,7 @@ class AsyncVWS:
|
|
|
446
431
|
)
|
|
447
432
|
|
|
448
433
|
result_data = dict(json.loads(s=response.text))
|
|
449
|
-
return TargetSummaryReport(
|
|
450
|
-
status=TargetStatuses(
|
|
451
|
-
value=result_data["status"],
|
|
452
|
-
),
|
|
453
|
-
database_name=result_data["database_name"],
|
|
454
|
-
target_name=result_data["target_name"],
|
|
455
|
-
upload_date=date.fromisoformat(
|
|
456
|
-
result_data["upload_date"],
|
|
457
|
-
),
|
|
458
|
-
active_flag=bool(result_data["active_flag"]),
|
|
459
|
-
tracking_rating=int(
|
|
460
|
-
result_data["tracking_rating"],
|
|
461
|
-
),
|
|
462
|
-
total_recos=int(result_data["total_recos"]),
|
|
463
|
-
current_month_recos=int(
|
|
464
|
-
result_data["current_month_recos"],
|
|
465
|
-
),
|
|
466
|
-
previous_month_recos=int(
|
|
467
|
-
result_data["previous_month_recos"],
|
|
468
|
-
),
|
|
469
|
-
)
|
|
434
|
+
return TargetSummaryReport.from_response_dict(result_data) # type: ignore[misc]
|
|
470
435
|
|
|
471
436
|
async def get_database_summary_report(
|
|
472
437
|
self,
|
|
@@ -501,30 +466,7 @@ class AsyncVWS:
|
|
|
501
466
|
)
|
|
502
467
|
|
|
503
468
|
response_data = dict(json.loads(s=response.text))
|
|
504
|
-
return DatabaseSummaryReport(
|
|
505
|
-
active_images=int(response_data["active_images"]),
|
|
506
|
-
current_month_recos=int(
|
|
507
|
-
response_data["current_month_recos"],
|
|
508
|
-
),
|
|
509
|
-
failed_images=int(response_data["failed_images"]),
|
|
510
|
-
inactive_images=int(
|
|
511
|
-
response_data["inactive_images"],
|
|
512
|
-
),
|
|
513
|
-
name=str(object=response_data["name"]),
|
|
514
|
-
previous_month_recos=int(
|
|
515
|
-
response_data["previous_month_recos"],
|
|
516
|
-
),
|
|
517
|
-
processing_images=int(
|
|
518
|
-
response_data["processing_images"],
|
|
519
|
-
),
|
|
520
|
-
reco_threshold=int(
|
|
521
|
-
response_data["reco_threshold"],
|
|
522
|
-
),
|
|
523
|
-
request_quota=int(response_data["request_quota"]),
|
|
524
|
-
request_usage=int(response_data["request_usage"]),
|
|
525
|
-
target_quota=int(response_data["target_quota"]),
|
|
526
|
-
total_recos=int(response_data["total_recos"]),
|
|
527
|
-
)
|
|
469
|
+
return DatabaseSummaryReport.from_response_dict(response_data) # type: ignore[misc]
|
|
528
470
|
|
|
529
471
|
async def delete_target(self, target_id: str) -> None:
|
|
530
472
|
"""Delete a given target.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Tools for interacting with the Vuforia Cloud Recognition Web APIs."""
|
|
2
2
|
|
|
3
|
-
import datetime
|
|
4
3
|
import json
|
|
5
4
|
from http import HTTPMethod, HTTPStatus
|
|
6
5
|
from typing import Any
|
|
@@ -23,7 +22,7 @@ from vws.exceptions.custom_exceptions import (
|
|
|
23
22
|
ServerError,
|
|
24
23
|
)
|
|
25
24
|
from vws.include_target_data import CloudRecoIncludeTargetData
|
|
26
|
-
from vws.reports import QueryResult
|
|
25
|
+
from vws.reports import QueryResult
|
|
27
26
|
from vws.transports import RequestsTransport, Transport
|
|
28
27
|
|
|
29
28
|
|
|
@@ -165,28 +164,5 @@ class CloudRecoService:
|
|
|
165
164
|
}[result_code]
|
|
166
165
|
raise exception(response=response)
|
|
167
166
|
|
|
168
|
-
result: list[QueryResult] = []
|
|
169
167
|
result_list = list(json.loads(s=response.text)["results"])
|
|
170
|
-
for item in result_list:
|
|
171
|
-
target_data: TargetData | None = None
|
|
172
|
-
if "target_data" in item:
|
|
173
|
-
target_data_dict = item["target_data"]
|
|
174
|
-
metadata = target_data_dict["application_metadata"]
|
|
175
|
-
timestamp_string = target_data_dict["target_timestamp"]
|
|
176
|
-
target_timestamp = datetime.datetime.fromtimestamp(
|
|
177
|
-
timestamp=timestamp_string,
|
|
178
|
-
tz=datetime.UTC,
|
|
179
|
-
)
|
|
180
|
-
target_data = TargetData(
|
|
181
|
-
name=target_data_dict["name"],
|
|
182
|
-
application_metadata=metadata,
|
|
183
|
-
target_timestamp=target_timestamp,
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
query_result = QueryResult(
|
|
187
|
-
target_id=item["target_id"],
|
|
188
|
-
target_data=target_data,
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
result.append(query_result)
|
|
192
|
-
return result
|
|
168
|
+
return [QueryResult.from_response_dict(item) for item in result_list] # type: ignore[misc]
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"""Classes for representing Vuforia reports."""
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum, unique
|
|
6
|
+
from typing import Any, Self
|
|
7
|
+
|
|
8
|
+
from beartype import BeartypeConf, beartype
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@beartype
|
|
12
|
+
@dataclass(frozen=True)
|
|
13
|
+
class DatabaseSummaryReport:
|
|
14
|
+
"""A database summary report.
|
|
15
|
+
|
|
16
|
+
See
|
|
17
|
+
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#summary-report.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
active_images: int
|
|
21
|
+
current_month_recos: int
|
|
22
|
+
failed_images: int
|
|
23
|
+
inactive_images: int
|
|
24
|
+
name: str
|
|
25
|
+
previous_month_recos: int
|
|
26
|
+
processing_images: int
|
|
27
|
+
reco_threshold: int
|
|
28
|
+
request_quota: int
|
|
29
|
+
request_usage: int
|
|
30
|
+
target_quota: int
|
|
31
|
+
total_recos: int
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_response_dict(cls, response_dict: dict[str, Any]) -> Self:
|
|
35
|
+
"""Construct from a VWS API response dict."""
|
|
36
|
+
return cls(
|
|
37
|
+
active_images=int(response_dict["active_images"]),
|
|
38
|
+
current_month_recos=int(response_dict["current_month_recos"]),
|
|
39
|
+
failed_images=int(response_dict["failed_images"]),
|
|
40
|
+
inactive_images=int(response_dict["inactive_images"]),
|
|
41
|
+
name=response_dict["name"],
|
|
42
|
+
previous_month_recos=int(response_dict["previous_month_recos"]),
|
|
43
|
+
processing_images=int(response_dict["processing_images"]),
|
|
44
|
+
reco_threshold=int(response_dict["reco_threshold"]),
|
|
45
|
+
request_quota=int(response_dict["request_quota"]),
|
|
46
|
+
request_usage=int(response_dict["request_usage"]),
|
|
47
|
+
target_quota=int(response_dict["target_quota"]),
|
|
48
|
+
total_recos=int(response_dict["total_recos"]),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@beartype
|
|
53
|
+
@unique
|
|
54
|
+
class TargetStatuses(Enum):
|
|
55
|
+
"""Constants representing VWS target statuses.
|
|
56
|
+
|
|
57
|
+
See the 'status' field in
|
|
58
|
+
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
PROCESSING = "processing"
|
|
62
|
+
SUCCESS = "success"
|
|
63
|
+
FAILED = "failed"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@beartype
|
|
67
|
+
@dataclass(frozen=True)
|
|
68
|
+
class TargetSummaryReport:
|
|
69
|
+
"""A target summary report.
|
|
70
|
+
|
|
71
|
+
See
|
|
72
|
+
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#summary-report.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
status: TargetStatuses
|
|
76
|
+
database_name: str
|
|
77
|
+
target_name: str
|
|
78
|
+
upload_date: datetime.date
|
|
79
|
+
active_flag: bool
|
|
80
|
+
tracking_rating: int
|
|
81
|
+
total_recos: int
|
|
82
|
+
current_month_recos: int
|
|
83
|
+
previous_month_recos: int
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_response_dict(cls, response_dict: dict[str, Any]) -> Self:
|
|
87
|
+
"""Construct from a VWS API response dict."""
|
|
88
|
+
return cls(
|
|
89
|
+
status=TargetStatuses(value=response_dict["status"]),
|
|
90
|
+
database_name=response_dict["database_name"],
|
|
91
|
+
target_name=response_dict["target_name"],
|
|
92
|
+
upload_date=datetime.date.fromisoformat(
|
|
93
|
+
response_dict["upload_date"]
|
|
94
|
+
),
|
|
95
|
+
active_flag=bool(response_dict["active_flag"]),
|
|
96
|
+
tracking_rating=int(response_dict["tracking_rating"]),
|
|
97
|
+
total_recos=int(response_dict["total_recos"]),
|
|
98
|
+
current_month_recos=int(response_dict["current_month_recos"]),
|
|
99
|
+
previous_month_recos=int(response_dict["previous_month_recos"]),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@beartype(conf=BeartypeConf(is_pep484_tower=True))
|
|
104
|
+
@dataclass(frozen=True)
|
|
105
|
+
class TargetRecord:
|
|
106
|
+
"""A target record.
|
|
107
|
+
|
|
108
|
+
See
|
|
109
|
+
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
target_id: str
|
|
113
|
+
active_flag: bool
|
|
114
|
+
name: str
|
|
115
|
+
width: float
|
|
116
|
+
tracking_rating: int
|
|
117
|
+
reco_rating: str
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@beartype
|
|
121
|
+
@dataclass(frozen=True)
|
|
122
|
+
class TargetData:
|
|
123
|
+
"""The target data optionally included with a query match."""
|
|
124
|
+
|
|
125
|
+
name: str
|
|
126
|
+
application_metadata: str | None
|
|
127
|
+
target_timestamp: datetime.datetime
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@beartype
|
|
131
|
+
@dataclass(frozen=True)
|
|
132
|
+
class QueryResult:
|
|
133
|
+
"""One query match result.
|
|
134
|
+
|
|
135
|
+
See
|
|
136
|
+
https://developer.vuforia.com/library/web-api/vuforia-query-web-api.
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
target_id: str
|
|
140
|
+
target_data: TargetData | None
|
|
141
|
+
|
|
142
|
+
@classmethod
|
|
143
|
+
def from_response_dict(cls, response_dict: dict[str, Any]) -> Self:
|
|
144
|
+
"""Construct from a VWS API query result item dict."""
|
|
145
|
+
target_data: TargetData | None = None
|
|
146
|
+
if "target_data" in response_dict:
|
|
147
|
+
target_data_dict = response_dict["target_data"]
|
|
148
|
+
target_timestamp = datetime.datetime.fromtimestamp(
|
|
149
|
+
timestamp=target_data_dict["target_timestamp"],
|
|
150
|
+
tz=datetime.UTC,
|
|
151
|
+
)
|
|
152
|
+
target_data = TargetData(
|
|
153
|
+
name=target_data_dict["name"],
|
|
154
|
+
application_metadata=target_data_dict["application_metadata"],
|
|
155
|
+
target_timestamp=target_timestamp,
|
|
156
|
+
)
|
|
157
|
+
return cls(
|
|
158
|
+
target_id=response_dict["target_id"],
|
|
159
|
+
target_data=target_data,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
@beartype
|
|
164
|
+
@dataclass(frozen=True)
|
|
165
|
+
class TargetStatusAndRecord:
|
|
166
|
+
"""The target status and a target record.
|
|
167
|
+
|
|
168
|
+
See
|
|
169
|
+
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record.
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
status: TargetStatuses
|
|
173
|
+
target_record: TargetRecord
|
|
174
|
+
|
|
175
|
+
@classmethod
|
|
176
|
+
def from_response_dict(cls, response_dict: dict[str, Any]) -> Self:
|
|
177
|
+
"""Construct from a VWS API response dict."""
|
|
178
|
+
status = TargetStatuses(value=response_dict["status"])
|
|
179
|
+
target_record_dict = dict(response_dict["target_record"])
|
|
180
|
+
target_record = TargetRecord(
|
|
181
|
+
target_id=target_record_dict["target_id"],
|
|
182
|
+
active_flag=bool(target_record_dict["active_flag"]),
|
|
183
|
+
name=target_record_dict["name"],
|
|
184
|
+
width=float(target_record_dict["width"]),
|
|
185
|
+
tracking_rating=int(target_record_dict["tracking_rating"]),
|
|
186
|
+
reco_rating=target_record_dict["reco_rating"],
|
|
187
|
+
)
|
|
188
|
+
return cls(status=status, target_record=target_record)
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import base64
|
|
4
4
|
import json
|
|
5
5
|
import time
|
|
6
|
-
from datetime import date
|
|
7
6
|
from http import HTTPMethod, HTTPStatus
|
|
8
7
|
|
|
9
8
|
from beartype import BeartypeConf, beartype
|
|
@@ -37,7 +36,6 @@ from vws.exceptions.vws_exceptions import (
|
|
|
37
36
|
)
|
|
38
37
|
from vws.reports import (
|
|
39
38
|
DatabaseSummaryReport,
|
|
40
|
-
TargetRecord,
|
|
41
39
|
TargetStatusAndRecord,
|
|
42
40
|
TargetStatuses,
|
|
43
41
|
TargetSummaryReport,
|
|
@@ -283,20 +281,7 @@ class VWS:
|
|
|
283
281
|
)
|
|
284
282
|
|
|
285
283
|
result_data = json.loads(s=response.text)
|
|
286
|
-
|
|
287
|
-
target_record_dict = dict(result_data["target_record"])
|
|
288
|
-
target_record = TargetRecord(
|
|
289
|
-
target_id=target_record_dict["target_id"],
|
|
290
|
-
active_flag=bool(target_record_dict["active_flag"]),
|
|
291
|
-
name=target_record_dict["name"],
|
|
292
|
-
width=float(target_record_dict["width"]),
|
|
293
|
-
tracking_rating=int(target_record_dict["tracking_rating"]),
|
|
294
|
-
reco_rating=target_record_dict["reco_rating"],
|
|
295
|
-
)
|
|
296
|
-
return TargetStatusAndRecord(
|
|
297
|
-
status=status,
|
|
298
|
-
target_record=target_record,
|
|
299
|
-
)
|
|
284
|
+
return TargetStatusAndRecord.from_response_dict(result_data) # type: ignore[misc]
|
|
300
285
|
|
|
301
286
|
def wait_for_target_processed(
|
|
302
287
|
self,
|
|
@@ -420,17 +405,7 @@ class VWS:
|
|
|
420
405
|
)
|
|
421
406
|
|
|
422
407
|
result_data = dict(json.loads(s=response.text))
|
|
423
|
-
return TargetSummaryReport(
|
|
424
|
-
status=TargetStatuses(value=result_data["status"]),
|
|
425
|
-
database_name=result_data["database_name"],
|
|
426
|
-
target_name=result_data["target_name"],
|
|
427
|
-
upload_date=date.fromisoformat(result_data["upload_date"]),
|
|
428
|
-
active_flag=bool(result_data["active_flag"]),
|
|
429
|
-
tracking_rating=int(result_data["tracking_rating"]),
|
|
430
|
-
total_recos=int(result_data["total_recos"]),
|
|
431
|
-
current_month_recos=int(result_data["current_month_recos"]),
|
|
432
|
-
previous_month_recos=int(result_data["previous_month_recos"]),
|
|
433
|
-
)
|
|
408
|
+
return TargetSummaryReport.from_response_dict(result_data) # type: ignore[misc]
|
|
434
409
|
|
|
435
410
|
def get_database_summary_report(self) -> DatabaseSummaryReport:
|
|
436
411
|
"""Get a summary report for the database.
|
|
@@ -463,20 +438,7 @@ class VWS:
|
|
|
463
438
|
)
|
|
464
439
|
|
|
465
440
|
response_data = dict(json.loads(s=response.text))
|
|
466
|
-
return DatabaseSummaryReport(
|
|
467
|
-
active_images=int(response_data["active_images"]),
|
|
468
|
-
current_month_recos=int(response_data["current_month_recos"]),
|
|
469
|
-
failed_images=int(response_data["failed_images"]),
|
|
470
|
-
inactive_images=int(response_data["inactive_images"]),
|
|
471
|
-
name=str(object=response_data["name"]),
|
|
472
|
-
previous_month_recos=int(response_data["previous_month_recos"]),
|
|
473
|
-
processing_images=int(response_data["processing_images"]),
|
|
474
|
-
reco_threshold=int(response_data["reco_threshold"]),
|
|
475
|
-
request_quota=int(response_data["request_quota"]),
|
|
476
|
-
request_usage=int(response_data["request_usage"]),
|
|
477
|
-
target_quota=int(response_data["target_quota"]),
|
|
478
|
-
total_recos=int(response_data["total_recos"]),
|
|
479
|
-
)
|
|
441
|
+
return DatabaseSummaryReport.from_response_dict(response_data) # type: ignore[misc]
|
|
480
442
|
|
|
481
443
|
def delete_target(self, target_id: str) -> None:
|
|
482
444
|
"""Delete a given target.
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"""Classes for representing Vuforia reports."""
|
|
2
|
-
|
|
3
|
-
import datetime
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from enum import Enum, unique
|
|
6
|
-
|
|
7
|
-
from beartype import BeartypeConf, beartype
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@beartype
|
|
11
|
-
@dataclass(frozen=True)
|
|
12
|
-
class DatabaseSummaryReport:
|
|
13
|
-
"""A database summary report.
|
|
14
|
-
|
|
15
|
-
See
|
|
16
|
-
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#summary-report.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
active_images: int
|
|
20
|
-
current_month_recos: int
|
|
21
|
-
failed_images: int
|
|
22
|
-
inactive_images: int
|
|
23
|
-
name: str
|
|
24
|
-
previous_month_recos: int
|
|
25
|
-
processing_images: int
|
|
26
|
-
reco_threshold: int
|
|
27
|
-
request_quota: int
|
|
28
|
-
request_usage: int
|
|
29
|
-
target_quota: int
|
|
30
|
-
total_recos: int
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@beartype
|
|
34
|
-
@unique
|
|
35
|
-
class TargetStatuses(Enum):
|
|
36
|
-
"""Constants representing VWS target statuses.
|
|
37
|
-
|
|
38
|
-
See the 'status' field in
|
|
39
|
-
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record
|
|
40
|
-
"""
|
|
41
|
-
|
|
42
|
-
PROCESSING = "processing"
|
|
43
|
-
SUCCESS = "success"
|
|
44
|
-
FAILED = "failed"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
@beartype
|
|
48
|
-
@dataclass(frozen=True)
|
|
49
|
-
class TargetSummaryReport:
|
|
50
|
-
"""A target summary report.
|
|
51
|
-
|
|
52
|
-
See
|
|
53
|
-
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#summary-report.
|
|
54
|
-
"""
|
|
55
|
-
|
|
56
|
-
status: TargetStatuses
|
|
57
|
-
database_name: str
|
|
58
|
-
target_name: str
|
|
59
|
-
upload_date: datetime.date
|
|
60
|
-
active_flag: bool
|
|
61
|
-
tracking_rating: int
|
|
62
|
-
total_recos: int
|
|
63
|
-
current_month_recos: int
|
|
64
|
-
previous_month_recos: int
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
@beartype(conf=BeartypeConf(is_pep484_tower=True))
|
|
68
|
-
@dataclass(frozen=True)
|
|
69
|
-
class TargetRecord:
|
|
70
|
-
"""A target record.
|
|
71
|
-
|
|
72
|
-
See
|
|
73
|
-
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record.
|
|
74
|
-
"""
|
|
75
|
-
|
|
76
|
-
target_id: str
|
|
77
|
-
active_flag: bool
|
|
78
|
-
name: str
|
|
79
|
-
width: float
|
|
80
|
-
tracking_rating: int
|
|
81
|
-
reco_rating: str
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
@beartype
|
|
85
|
-
@dataclass(frozen=True)
|
|
86
|
-
class TargetData:
|
|
87
|
-
"""The target data optionally included with a query match."""
|
|
88
|
-
|
|
89
|
-
name: str
|
|
90
|
-
application_metadata: str | None
|
|
91
|
-
target_timestamp: datetime.datetime
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
@beartype
|
|
95
|
-
@dataclass(frozen=True)
|
|
96
|
-
class QueryResult:
|
|
97
|
-
"""One query match result.
|
|
98
|
-
|
|
99
|
-
See
|
|
100
|
-
https://developer.vuforia.com/library/web-api/vuforia-query-web-api.
|
|
101
|
-
"""
|
|
102
|
-
|
|
103
|
-
target_id: str
|
|
104
|
-
target_data: TargetData | None
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
@beartype
|
|
108
|
-
@dataclass(frozen=True)
|
|
109
|
-
class TargetStatusAndRecord:
|
|
110
|
-
"""The target status and a target record.
|
|
111
|
-
|
|
112
|
-
See
|
|
113
|
-
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#target-record.
|
|
114
|
-
"""
|
|
115
|
-
|
|
116
|
-
status: TargetStatuses
|
|
117
|
-
target_record: TargetRecord
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{vws_python-2026.2.25 → vws_python-2026.2.25.1}/src/vws_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|