Python API¶
This reference is generated from the source code.
Tools for interacting with the VWS (Vuforia Web Services) website.
- class vws_web_tools.DatabaseDict¶
Bases:
TypedDictA dictionary type which represents a database.
- client_access_key¶
- client_secret_key¶
- database_id¶
- database_name¶
- server_access_key¶
- server_secret_key¶
- class vws_web_tools.LicenseDict¶
Bases:
TypedDictA dictionary type which represents a license.
- license_key¶
- license_name¶
- class vws_web_tools.ModelTargetWebAPIDict¶
Bases:
TypedDictA dictionary type which represents Model Target Web API details.
- cad_data_url¶
- client_id¶
- client_secret¶
- class vws_web_tools.VuMarkDatabaseDict¶
Bases:
TypedDictA dictionary type which represents a VuMark database.
VuMark databases only have server access keys.
- database_name¶
- server_access_key¶
- server_secret_key¶
- class vws_web_tools._BrowserStateReader(*args, **kwargs)¶
Bases:
_ScriptExecutor,_CookieReader,ProtocolBrowser state needed to create an authenticated HTTP session.
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = True¶
- _is_runtime_protocol = True¶
- property current_url¶
Return the current browser URL.
- class vws_web_tools._CookieReader(*args, **kwargs)¶
Bases:
ProtocolThe typed part of Selenium’s cookie-reading interface.
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = True¶
- get_cookies()¶
Return the current browser cookies.
- class vws_web_tools._ModelTargetWebAPIClientCredentials(*, client_id, client_secret)¶
Bases:
objectModel Target Web API client credentials.
- client_id¶
- client_secret¶
- class vws_web_tools._ModelTargetWebAPICredentialsAPISession(*, session, access_token)¶
Bases:
objectAuthenticated session for the credentials management API.
- access_token¶
- session¶
- class vws_web_tools._ScriptExecutor(*args, **kwargs)¶
Bases:
ProtocolThe typed part of Selenium’s script-execution interface.
- _abc_impl = <_abc._abc_data object>¶
- _is_protocol = True¶
- execute_script(script, /)¶
Execute JavaScript and return its decoded value.
- vws_web_tools._access_key_pair(*, driver, key_id)¶
Return the access key and secret key shown in a key section.
Call this only after
_wait_for_access_keyshas returned for the section: that is what guarantees that both boxes are there and filled in. Boxes after the first two are ignored, so that the target manager growing another one does not change what this returns.
- vws_web_tools._cookies(*, driver)¶
Read Selenium cookies through a typed boundary.
- vws_web_tools._create_model_target_web_api_client_credentials(*, driver, credential_name, scopes)¶
Create OAuth2 client credentials for the Model Target Web API.
- vws_web_tools._database_id_from_current_url(*, driver)¶
Get a database’s ID from the URL of its page in the target manager.
navigate_to_databaselands on a URL with a path of the form/develop/databases/{database_id}/targets, and the ID is not shown anywhere else on the page.
- vws_web_tools._dismiss_cookie_banner(*, driver)¶
Dismiss the OneTrust cookie consent banner if present.
- vws_web_tools._execute_script(*, driver, script)¶
Execute a Selenium script through a typed boundary.
- vws_web_tools._is_json_array(value, /)¶
Return whether value is a JSON array.
- vws_web_tools._is_json_object(value, /)¶
Return whether value is a JSON object.
- vws_web_tools._is_retryable_request_exception(exception)¶
Return whether a credentials API request failure is transient.
- vws_web_tools._json_request(*, session, method, url, data, access_token)¶
Make a JSON request and return the response body.
- vws_web_tools._log_in_once(*, driver, email_address, password)¶
Submit the login form once.
- vws_web_tools._model_target_web_api_credentials_api_session(*, driver)¶
Return a session and token for the credentials management API.
- vws_web_tools._open_add_database_dialog(*, driver, database_name)¶
Navigate to databases page, open the add-database dialog, and enter the name.
Returns a
WebDriverWaitfor further use.
- vws_web_tools._open_target_key_tab(*, wait)¶
Click the target-key tab of a VuMark database.
The tab is clicked exactly once. The wait is what makes the tab being slow to render survivable: it retries until the click goes through, and returns as soon as one has.
- vws_web_tools._request(*, session, method, url, data, access_token)¶
Make a request to the Vuforia credentials API.
- vws_web_tools._request_once(*, session, method, url, headers, data)¶
Make one request to the credentials API.
- vws_web_tools._request_with_retry(*, session, method, url, headers, data)¶
Make a request, retrying safe transient failures.
- vws_web_tools._requests_session_from_driver(*, driver)¶
Create a requests session using the browser’s authenticated cookies.
- vws_web_tools._sleep_before_request_retry(seconds)¶
Sleep between credentials API request attempts.
- vws_web_tools._string_from_json(*, value, keys)¶
Find a non-empty string in a JSON-like value.
- vws_web_tools._submit_add_database_dialog(*, wait)¶
Click the generate button and wait for the dialog to close.
- vws_web_tools._wait_for_access_keys(*, wait, key_ids)¶
Wait for key sections to show an access key and a secret key.
- vws_web_tools._xpath_literal(*, value)¶
Return an XPath string literal.
XPath 1.0 string literals have no escape syntax, so a value which contains an apostrophe cannot be wrapped in apostrophes. Wrap such a value in quotation marks instead, and build a
concat()expression for a value which contains both.
- vws_web_tools.create_chrome_driver()¶
Create a headless Chrome WebDriver.
- vws_web_tools.create_cloud_database(*, driver, database_name, license_name)¶
Create a cloud database.
- vws_web_tools.create_license(*, driver, license_name)¶
Create a license.
- vws_web_tools.create_vumark_database(*, driver, database_name)¶
Create a VuMark database.
- vws_web_tools.delete_license(*, driver, license_name)¶
Delete a license.
- vws_web_tools.delete_model_target_web_api_client_credentials(*, driver, client_id)¶
Delete one OAuth2 client credential by its exact client ID.
- vws_web_tools.get_database_details(*, driver, database_name)¶
Get details of a database.
- vws_web_tools.get_license_details(*, driver, license_name)¶
Get details of a license.
- vws_web_tools.get_model_target_web_api_details(*, driver, scopes=('modeltargets.standardmodeltarget.all',), cad_data_url='https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/d7a3cc8e51d7c573771ae77a57f16b0662a905c6/2.0/Duck/glTF-Binary/Duck.glb')¶
Get Model Target Web API credentials and a CAD data URL.
The
scopesargument selects which OAuth2 scopes are requested for the created credential. It defaults toMODEL_TARGET_WEB_API_STANDARD_SCOPES, which is the only set of scopes available on non-Enterprise developer accounts. PassMODEL_TARGET_WEB_API_ADVANCED_SCOPESto additionally request the advanced Model Target scope; this requires a Vuforia Enterprise developer account, and credential creation raises aRuntimeErrorif the account is not entitled to a requested scope.The
cad_data_urlargument is returned as-is, as thecad_data_urlitem of the result. It defaults toMODEL_TARGET_WEB_API_CAD_DATA_URL, a model pinned to a commit in the glTF sample models repository. Pass another URL to use a different model, or if that one stops resolving.
- vws_web_tools.get_vumark_database_details(*, driver, database_name)¶
Get details of a VuMark database.
VuMark databases only have server access keys.
- vws_web_tools.get_vumark_target_id(*, driver, database_name, target_name)¶
Get the ID for a VuMark target in a database.
- Limitation:
While a target is still processing, VWS renders plain text in the target-name column rather than a link, and no target ID is available. This waits up to 30 seconds for the link, and then hard-errors. Use
wait_for_vumark_target_linkfirst to wait for longer than that.
- vws_web_tools.log_in(*, driver, email_address, password)¶
Log in to Vuforia web services, retrying on timeout.
- vws_web_tools.model_target_web_api_details(*, driver, scopes=('modeltargets.standardmodeltarget.all',), cad_data_url='https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/d7a3cc8e51d7c573771ae77a57f16b0662a905c6/2.0/Duck/glTF-Binary/Duck.glb')¶
Yield Model Target Web API details, then delete the credential.
get_model_target_web_api_detailscreates an OAuth2 client credential on the Vuforia account, and nothing deletes it. A caller which raises before it gets todelete_model_target_web_api_client_credentialsleaves the credential on the account. This deletes the credential however thewithblock is left.See
get_model_target_web_api_detailsfor thescopesandcad_data_urlarguments.
Navigate to a database’s page in the target manager.
Navigate to a license’s page in the developer portal.
- vws_web_tools.upload_vumark_template(*, driver, database_name, svg_file_path, template_name, width)¶
Upload a VuMark SVG template to a VuMark database.
- Returns:
The ID of the uploaded target. Waiting for the ID means waiting for VWS to finish processing the target, which takes longer than waiting for the target to appear in the targets table.
- vws_web_tools.wait_for_logged_in(*, driver)¶
Wait for the user to be logged in.
Without this, we sometimes get a redirect to a post-login page.
- vws_web_tools.wait_for_vumark_target_link(*, driver, database_name, target_name, timeout=180)¶
Wait for a VuMark target row to be rendered on the target-key tab.
This waits until the matching target row is rendered as a clickable link.