|
15 | 15 |
|
16 | 16 | from vws._authorization import authorization_header, rfc_1123_date |
17 | 17 | from vws._result_codes import raise_for_result_code |
18 | | -from vws.exceptions import ( |
19 | | - AuthenticationFailure, |
20 | | - BadImage, |
21 | | - DateRangeError, |
22 | | - Fail, |
23 | | - ImageTooLarge, |
24 | | - InactiveProject, |
25 | | - MetadataTooLarge, |
26 | | - ProjectInactive, |
27 | | - RequestQuotaReached, |
28 | | - RequestTimeTooSkewed, |
29 | | - TargetNameExist, |
30 | | - TargetProcessingTimeout, |
31 | | - TargetStatusNotSuccess, |
32 | | - TargetStatusProcessing, |
33 | | - UnknownTarget, |
34 | | -) |
| 18 | +from vws.exceptions import TargetProcessingTimeout |
35 | 19 |
|
36 | 20 |
|
37 | 21 | def _target_api_request( |
@@ -91,44 +75,6 @@ def _target_api_request( |
91 | 75 | return response |
92 | 76 |
|
93 | 77 |
|
94 | | -<<<<<<< HEAD |
95 | | -def _raise_for_result_code( |
96 | | - response: Response, |
97 | | - expected_result_code: str, |
98 | | -) -> None: |
99 | | - """ |
100 | | - Raise an appropriate exception if the expected result code for a successful |
101 | | - request is not returned. |
102 | | -
|
103 | | - Args: |
104 | | - response: A response from Vuforia. |
105 | | - expected_result_code: See |
106 | | - https://library.vuforia.com/articles/Solution/How-To-Use-the-Vuforia-Web-Services-API.html#How-To-Interperete-VWS-API-Result-Codes |
107 | | - """ |
108 | | - result_code = response.json()['result_code'] |
109 | | - if result_code == expected_result_code: |
110 | | - return |
111 | | - |
112 | | - exception = { |
113 | | - 'AuthenticationFailure': AuthenticationFailure, |
114 | | - 'BadImage': BadImage, |
115 | | - 'DateRangeError': DateRangeError, |
116 | | - 'Fail': Fail, |
117 | | - 'ImageTooLarge': ImageTooLarge, |
118 | | - 'InactiveProject': InactiveProject, |
119 | | - 'MetadataTooLarge': MetadataTooLarge, |
120 | | - 'ProjectInactive': ProjectInactive, |
121 | | - 'RequestQuotaReached': RequestQuotaReached, |
122 | | - 'RequestTimeTooSkewed': RequestTimeTooSkewed, |
123 | | - 'TargetNameExist': TargetNameExist, |
124 | | - 'TargetStatusNotSuccess': TargetStatusNotSuccess, |
125 | | - 'TargetStatusProcessing': TargetStatusProcessing, |
126 | | - 'UnknownTarget': UnknownTarget, |
127 | | - }[result_code] |
128 | | - |
129 | | - raise exception(response=response) |
130 | | - |
131 | | - |
132 | 78 | class VWS: |
133 | 79 | """ |
134 | 80 | An interface to Vuforia Web Services APIs. |
|
0 commit comments