File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed
Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 55 },
66 "editor.defaultFormatter" : " charliermarsh.ruff" ,
77 "editor.formatOnSave" : true
8- }
8+ },
9+ "esbonio.sphinx.confDir" : " "
910}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ TargetProcessingTimeout
1919TargetQuotaReached
2020TargetStatusNotSuccess
2121TargetStatusProcessing
22+ TooManyRequests
2223Ubuntu
2324UnknownTarget
2425UnknownVWSErrorPossiblyBadName
Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ class RequestQuotaReached(VWSException): # pragma: no cover
5656 """
5757
5858
59+ class TooManyRequests (VWSException ): # pragma: no cover
60+ """
61+ Exception raised when Vuforia returns a response with a result code
62+ 'TooManyRequests'.
63+ """
64+
65+
5966class TargetStatusProcessing (VWSException ):
6067 """
6168 Exception raised when Vuforia returns a response with a result code
Original file line number Diff line number Diff line change 88import json
99import time
1010from datetime import date
11+ from http import HTTPStatus
1112from typing import TYPE_CHECKING , BinaryIO
1213from urllib .parse import urljoin
1314
3536 TargetQuotaReached ,
3637 TargetStatusNotSuccess ,
3738 TargetStatusProcessing ,
39+ TooManyRequests ,
3840 UnknownTarget ,
3941)
4042from vws .reports import (
@@ -180,6 +182,12 @@ def _make_request(
180182 if "Oops, an error occurred" in response .text :
181183 raise UnknownVWSErrorPossiblyBadName
182184
185+ if (
186+ response .status_code == HTTPStatus .TOO_MANY_REQUESTS
187+ ): # pragma: no cover
188+ # The Vuforia API returns a 429 response with no JSON body.
189+ raise TooManyRequests (response = response )
190+
183191 result_code = response .json ()["result_code" ]
184192
185193 if result_code == expected_result_code :
You can’t perform that action at this time.
0 commit comments