@@ -150,7 +150,7 @@ def __init__(
150
150
self ._server_secret_key = server_secret_key
151
151
self ._base_vws_url = base_vws_url
152
152
153
- def _make_request (
153
+ def make_request (
154
154
self ,
155
155
method : str ,
156
156
data : bytes ,
@@ -160,32 +160,34 @@ def _make_request(
160
160
"""
161
161
Make a request to the Vuforia Target API.
162
162
163
- This uses `requests` to make a request against https://vws.vuforia.com .
163
+ This uses `requests` to make a request against Vuforia .
164
164
The content type of the request will be `application/json`.
165
165
166
166
Args:
167
167
method: The HTTP method which will be used in the request.
168
168
data: The request body which will be used in the request.
169
169
request_path: The path to the endpoint which will be used in the
170
170
request.
171
- expected_result_code: See
172
- https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#result-codes
171
+ expected_result_code: See "VWS API Result Codes" on
172
+ https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api.
173
173
174
174
Returns:
175
175
The response to the request made by `requests`.
176
176
177
177
Raises:
178
- ~vws.exceptions.OopsAnErrorOccurredPossiblyBadNameError: Vuforia
179
- returns an HTML page with the text "Oops, an error occurred".
178
+ ~vws.exceptions.custom_exceptions.OopsAnErrorOccurredPossiblyBadNameError:
179
+ Vuforia returns an HTML page with the text "Oops, an error
180
+ occurred".
181
+
180
182
This has been seen to happen when the given name includes a bad
181
183
character.
182
184
~vws.exceptions.custom_exceptions.ServerError: There is an error
183
185
with Vuforia's servers.
184
186
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
185
187
rate limiting access.
186
- json.decoder. JSONDecodeError: The server did not respond with valid
187
- JSON. This may happen if the server address is not a valid
188
- Vuforia server.
188
+ json.JSONDecodeError: The server did not respond with valid JSON.
189
+ This may happen if the server address is not a valid Vuforia
190
+ server.
189
191
"""
190
192
response = _target_api_request (
191
193
server_access_key = self ._server_access_key ,
@@ -309,7 +311,7 @@ def add_target(
309
311
310
312
content = json .dumps (obj = data ).encode (encoding = "utf-8" )
311
313
312
- response = self ._make_request (
314
+ response = self .make_request (
313
315
method = HTTPMethod .POST ,
314
316
data = content ,
315
317
request_path = "/targets" ,
@@ -346,7 +348,7 @@ def get_target_record(self, target_id: str) -> TargetStatusAndRecord:
346
348
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
347
349
rate limiting access.
348
350
"""
349
- response = self ._make_request (
351
+ response = self .make_request (
350
352
method = HTTPMethod .GET ,
351
353
data = b"" ,
352
354
request_path = f"/targets/{ target_id } " ,
@@ -442,7 +444,7 @@ def list_targets(self) -> list[str]:
442
444
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
443
445
rate limiting access.
444
446
"""
445
- response = self ._make_request (
447
+ response = self .make_request (
446
448
method = HTTPMethod .GET ,
447
449
data = b"" ,
448
450
request_path = "/targets" ,
@@ -479,7 +481,7 @@ def get_target_summary_report(self, target_id: str) -> TargetSummaryReport:
479
481
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
480
482
rate limiting access.
481
483
"""
482
- response = self ._make_request (
484
+ response = self .make_request (
483
485
method = HTTPMethod .GET ,
484
486
data = b"" ,
485
487
request_path = f"/summary/{ target_id } " ,
@@ -522,7 +524,7 @@ def get_database_summary_report(self) -> DatabaseSummaryReport:
522
524
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
523
525
rate limiting access.
524
526
"""
525
- response = self ._make_request (
527
+ response = self .make_request (
526
528
method = HTTPMethod .GET ,
527
529
data = b"" ,
528
530
request_path = "/summary" ,
@@ -572,7 +574,7 @@ def delete_target(self, target_id: str) -> None:
572
574
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
573
575
rate limiting access.
574
576
"""
575
- self ._make_request (
577
+ self .make_request (
576
578
method = HTTPMethod .DELETE ,
577
579
data = b"" ,
578
580
request_path = f"/targets/{ target_id } " ,
@@ -609,7 +611,7 @@ def get_duplicate_targets(self, target_id: str) -> list[str]:
609
611
~vws.exceptions.vws_exceptions.TooManyRequestsError: Vuforia is
610
612
rate limiting access.
611
613
"""
612
- response = self ._make_request (
614
+ response = self .make_request (
613
615
method = HTTPMethod .GET ,
614
616
data = b"" ,
615
617
request_path = f"/duplicates/{ target_id } " ,
@@ -695,7 +697,7 @@ def update_target(
695
697
696
698
content = json .dumps (obj = data ).encode (encoding = "utf-8" )
697
699
698
- self ._make_request (
700
+ self .make_request (
699
701
method = HTTPMethod .PUT ,
700
702
data = content ,
701
703
request_path = f"/targets/{ target_id } " ,
0 commit comments