tango-python 1.18.1__py3-none-any.whl → 1.18.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tango/__init__.py +1 -1
- tango/exceptions.py +10 -4
- {tango_python-1.18.1.dist-info → tango_python-1.18.2.dist-info}/METADATA +1 -1
- {tango_python-1.18.1.dist-info → tango_python-1.18.2.dist-info}/RECORD +7 -7
- {tango_python-1.18.1.dist-info → tango_python-1.18.2.dist-info}/WHEEL +0 -0
- {tango_python-1.18.1.dist-info → tango_python-1.18.2.dist-info}/entry_points.txt +0 -0
- {tango_python-1.18.1.dist-info → tango_python-1.18.2.dist-info}/licenses/LICENSE +0 -0
tango/__init__.py
CHANGED
tango/exceptions.py
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"""Tango API exceptions"""
|
|
2
2
|
|
|
3
|
+
import re
|
|
3
4
|
from typing import Any
|
|
4
5
|
|
|
6
|
+
# The API names the tripped rate in its 429 detail: "Rate limit exceeded for daily. Please try again in 16 hours, 58 minutes."
|
|
7
|
+
_RATE_NAME = re.compile(r"exceeded for ([\w-]+)", re.IGNORECASE)
|
|
8
|
+
|
|
5
9
|
|
|
6
10
|
class TangoAPIError(Exception):
|
|
7
11
|
"""Base exception for Tango API errors"""
|
|
@@ -88,11 +92,13 @@ class TangoRateLimitError(TangoAPIError):
|
|
|
88
92
|
d = self.detail
|
|
89
93
|
if not d:
|
|
90
94
|
return None
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if "daily" in
|
|
95
|
+
# Read the rate's name, not the whole sentence: a daily lockout's wait reads "16 hours, 58 minutes", which a match on "minute" took for burst.
|
|
96
|
+
match = _RATE_NAME.search(d)
|
|
97
|
+
text = match.group(1).lower() if match else d.lower()
|
|
98
|
+
if "daily" in text or re.search(r"\bday\b", text):
|
|
95
99
|
return "daily"
|
|
100
|
+
if "burst" in text or "minute" in text:
|
|
101
|
+
return "burst"
|
|
96
102
|
return None
|
|
97
103
|
|
|
98
104
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
tango/__init__.py,sha256=
|
|
1
|
+
tango/__init__.py,sha256=EcmM-sPf6gUtZML4RQbgS31RPAi4oz91N6XIIvpRjbk,2739
|
|
2
2
|
tango/client.py,sha256=awauFCq-gd-dCBAvDPeEBBgxwhuc_2ZzIhK-I7ki0U8,245711
|
|
3
|
-
tango/exceptions.py,sha256=
|
|
3
|
+
tango/exceptions.py,sha256=TL2MrSbcy99ogrJugLiP1I5J5qNih770knISycDTx-g,4661
|
|
4
4
|
tango/models.py,sha256=D9e8_AAAwVi1C4nOqdhWz-8ARBLPRsLGi8TDjucOMEY,72897
|
|
5
5
|
tango/shapes/__init__.py,sha256=7ea1WU74jp4znhNw-gXruag6m6eyPZtbVgbDFmFUWro,1072
|
|
6
6
|
tango/shapes/explicit_schemas.py,sha256=fwjHiFLOMpFyNLNM4M6kdK603s-t8gxHYqcSeL3jz7g,85674
|
|
@@ -16,8 +16,8 @@ tango/webhooks/cli.py,sha256=f_vQbJ2AeSQjKnQo7MxHFyUB2SAKcgHYmGQULS0isqQ,13858
|
|
|
16
16
|
tango/webhooks/receiver.py,sha256=5yhsVhlLyoxmOCGvmbynWAIlDB2OaCPVf1H4GA1SxmU,9279
|
|
17
17
|
tango/webhooks/signing.py,sha256=92Ee-0B6PR7ZkvY3Np3gzl88-mtfKkh-I7lxqCe2lGw,2374
|
|
18
18
|
tango/webhooks/simulate.py,sha256=g2Osa0FYU5mJuon07T2aUCtmkUoTEzsY261tlp76fF0,3165
|
|
19
|
-
tango_python-1.18.
|
|
20
|
-
tango_python-1.18.
|
|
21
|
-
tango_python-1.18.
|
|
22
|
-
tango_python-1.18.
|
|
23
|
-
tango_python-1.18.
|
|
19
|
+
tango_python-1.18.2.dist-info/METADATA,sha256=0kfKbSpvkJVxOpXsF7jerdb3dDyqc81PSAxbQRPN8fQ,22824
|
|
20
|
+
tango_python-1.18.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
21
|
+
tango_python-1.18.2.dist-info/entry_points.txt,sha256=kGLUbglUjuaAqEFvOZ1QuSW0vWb6VeSpCIFKaOFkKoQ,50
|
|
22
|
+
tango_python-1.18.2.dist-info/licenses/LICENSE,sha256=j2kYVHMwTkoGn3ZNScnrdIueG0k2XzB_LCPFoyBc2wk,1064
|
|
23
|
+
tango_python-1.18.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|