Add Model Target Web API client support - #3147
Conversation
Add ``ModelTargetService`` and ``AsyncModelTargetService``, which cover the create, poll, download and delete lifecycle for standard and advanced Model Target datasets. The clients authenticate with OAuth2 client credentials and reuse the returned bearer token until it expires. Typed request structures describe the models, guide views and State-Based Model Target configuration which Vuforia accepts, and the Model Target error envelope is parsed into public exceptions. Closes #3119. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 88034b2. Configure here.
|
|
||
| PROCESSING = "processing" | ||
| DONE = "done" | ||
| FAILED = "failed" |
There was a problem hiding this comment.
Missing cancelled dataset status
Medium Severity
ModelTargetDatasetStatuses only defines processing, done, and failed, but the Model Target Web API also returns cancelled when a dataset is deleted during generation. from_response_dict constructs the enum from the raw status string, so a cancelled dataset raises ValueError instead of a status report. wait_for_dataset_generated hits the same path and cannot finish.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 88034b2. Configure here.


Adds
ModelTargetServiceandAsyncModelTargetService, covering the full create, poll, download and delete lifecycle for standard and advanced Model Target datasets, with OAuth2 client-credentials authentication and a bearer token which is cached until shortly before it expires. Typed request structures describe the models, guide views and State-Based Model Target configuration which Vuforia accepts, typed status reports expose generation errors and warnings, and the Model Target error envelope is parsed into public exceptions. Documentation, an API reference entry and a news fragment are included, along with 48 tests which exercise both clients againstvws-python-mock.Closes #3119.
🤖 Generated with Claude Code
Note
Medium Risk
New OAuth2 credential handling and a large public API surface, but changes are additive with broad mock-based test coverage and no changes to existing VWS signing auth.
Overview
Adds Model Target Web API support via new
ModelTargetServiceandAsyncModelTargetServiceon the public package surface, covering create → poll → download → delete for standard and advanced datasets.Authentication uses OAuth2 client credentials (
client_id/client_secret), separate from VWS server keys, with cached bearer tokens refreshed before expiry. Shared logic in_model_targetsbuilds request bodies, maps HTTP status codes tomodel_target_exceptions, and parses status intoModelTargetDatasetStatusReport(including generation errors/warnings).model_target_datasetsadds typed models, guide views, and API option enums.Docs gain a Model Targets usage section, API reference entries, and exception docs; Sybil/doc
conftestand test fixtures wire mock OAuth env vars. Large sync/async test suites exercise the full lifecycle againstvws-python-mock.Reviewed by Cursor Bugbot for commit 88034b2. Bugbot is set up for automated code reviews on this repo. Configure here.