apitally 0.4.0__py3-none-any.whl → 0.4.1__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.
- apitally/__init__.py +1 -1
- apitally/client/asyncio.py +0 -2
- apitally/client/base.py +9 -2
- apitally/client/threading.py +0 -2
- {apitally-0.4.0.dist-info → apitally-0.4.1.dist-info}/METADATA +1 -1
- {apitally-0.4.0.dist-info → apitally-0.4.1.dist-info}/RECORD +8 -8
- {apitally-0.4.0.dist-info → apitally-0.4.1.dist-info}/LICENSE +0 -0
- {apitally-0.4.0.dist-info → apitally-0.4.1.dist-info}/WHEEL +0 -0
apitally/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.4.
|
1
|
+
__version__ = "0.4.1"
|
apitally/client/asyncio.py
CHANGED
@@ -36,14 +36,12 @@ class ApitallyClient(ApitallyClientBase):
|
|
36
36
|
client_id: str,
|
37
37
|
env: str,
|
38
38
|
sync_api_keys: bool = False,
|
39
|
-
sync_interval: float = 60,
|
40
39
|
key_cache_class: Optional[Type[ApitallyKeyCacheBase]] = None,
|
41
40
|
) -> None:
|
42
41
|
super().__init__(
|
43
42
|
client_id=client_id,
|
44
43
|
env=env,
|
45
44
|
sync_api_keys=sync_api_keys,
|
46
|
-
sync_interval=sync_interval,
|
47
45
|
key_cache_class=key_cache_class,
|
48
46
|
)
|
49
47
|
self._stop_sync_loop = False
|
apitally/client/base.py
CHANGED
@@ -23,6 +23,9 @@ HUB_BASE_URL = os.getenv("APITALLY_HUB_BASE_URL") or "https://hub.apitally.io"
|
|
23
23
|
HUB_VERSION = "v1"
|
24
24
|
REQUEST_TIMEOUT = 10
|
25
25
|
MAX_QUEUE_TIME = 3600
|
26
|
+
SYNC_INTERVAL = 60
|
27
|
+
INITIAL_SYNC_INTERVAL = 10
|
28
|
+
INITIAL_SYNC_INTERVAL_DURATION = 3600
|
26
29
|
|
27
30
|
TApitallyClient = TypeVar("TApitallyClient", bound="ApitallyClientBase")
|
28
31
|
|
@@ -43,7 +46,6 @@ class ApitallyClientBase:
|
|
43
46
|
client_id: str,
|
44
47
|
env: str,
|
45
48
|
sync_api_keys: bool = False,
|
46
|
-
sync_interval: float = 60,
|
47
49
|
key_cache_class: Optional[Type[ApitallyKeyCacheBase]] = None,
|
48
50
|
) -> None:
|
49
51
|
if hasattr(self, "client_id"):
|
@@ -58,7 +60,6 @@ class ApitallyClientBase:
|
|
58
60
|
self.client_id = client_id
|
59
61
|
self.env = env
|
60
62
|
self.sync_api_keys = sync_api_keys
|
61
|
-
self.sync_interval = sync_interval
|
62
63
|
self.instance_uuid = str(uuid4())
|
63
64
|
self.request_counter = RequestCounter()
|
64
65
|
self.validation_error_counter = ValidationErrorCounter()
|
@@ -82,6 +83,12 @@ class ApitallyClientBase:
|
|
82
83
|
raise RuntimeError("Apitally client not initialized") # pragma: no cover
|
83
84
|
return cast(TApitallyClient, cls._instance)
|
84
85
|
|
86
|
+
@property
|
87
|
+
def sync_interval(self) -> float:
|
88
|
+
return (
|
89
|
+
SYNC_INTERVAL if time.time() - self._started_at > INITIAL_SYNC_INTERVAL_DURATION else INITIAL_SYNC_INTERVAL
|
90
|
+
)
|
91
|
+
|
85
92
|
@property
|
86
93
|
def hub_url(self) -> str:
|
87
94
|
return f"{HUB_BASE_URL}/{HUB_VERSION}/{self.client_id}/{self.env}"
|
apitally/client/threading.py
CHANGED
@@ -53,14 +53,12 @@ class ApitallyClient(ApitallyClientBase):
|
|
53
53
|
client_id: str,
|
54
54
|
env: str,
|
55
55
|
sync_api_keys: bool = False,
|
56
|
-
sync_interval: float = 60,
|
57
56
|
key_cache_class: Optional[Type[ApitallyKeyCacheBase]] = None,
|
58
57
|
) -> None:
|
59
58
|
super().__init__(
|
60
59
|
client_id=client_id,
|
61
60
|
env=env,
|
62
61
|
sync_api_keys=sync_api_keys,
|
63
|
-
sync_interval=sync_interval,
|
64
62
|
key_cache_class=key_cache_class,
|
65
63
|
)
|
66
64
|
self._thread: Optional[Thread] = None
|
@@ -1,9 +1,9 @@
|
|
1
|
-
apitally/__init__.py,sha256=
|
1
|
+
apitally/__init__.py,sha256=pMtTmSUht-XtbR_7Doz6bsQqopJJd8rZ8I8zy2HwwoA,22
|
2
2
|
apitally/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
-
apitally/client/asyncio.py,sha256=
|
4
|
-
apitally/client/base.py,sha256=
|
3
|
+
apitally/client/asyncio.py,sha256=A7FEk-VD7YY2UPVBNaI8Roh3e0YLAVpD5iU6wS5067I,5977
|
4
|
+
apitally/client/base.py,sha256=iEBFWId-M6_V1roAE4z270iwdZQJ48NZ7trAOSEAUBk,12489
|
5
5
|
apitally/client/logging.py,sha256=QMsKIIAFo92PNBUleeTgsrsQa7SEal-oJa1oOHUr1wI,507
|
6
|
-
apitally/client/threading.py,sha256=
|
6
|
+
apitally/client/threading.py,sha256=CALCE4AGMMedhR5GpwiPqY4BZIiIu3TrIa-H2dzpxvg,6396
|
7
7
|
apitally/django.py,sha256=i2mb7sHes6Q4JE1kdo1BvDBBcGZzuv946e4MDlAE62c,10555
|
8
8
|
apitally/django_ninja.py,sha256=TFltgr03FzTnl83sUAXJj7R32u_g9DTZ9p-HuVKs4ZE,2785
|
9
9
|
apitally/django_rest_framework.py,sha256=UmJvxxiKGRdaILSbg6jJY_cvAl-mpuPY1pM0FoQ4bg0,1587
|
@@ -11,7 +11,7 @@ apitally/fastapi.py,sha256=YjnrRis8UG2M6Q3lkwizbtDXU7nPfCA4mebxG8XwveY,3334
|
|
11
11
|
apitally/flask.py,sha256=C3_Uk0XiVyayXURnzKvoG7EAFthA6PeV7mLys22BiO4,6960
|
12
12
|
apitally/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
apitally/starlette.py,sha256=8PQdvw0h0_rBVziPciMGtHf0vxJ_mlrKOSyFAB7Mr14,9941
|
14
|
-
apitally-0.4.
|
15
|
-
apitally-0.4.
|
16
|
-
apitally-0.4.
|
17
|
-
apitally-0.4.
|
14
|
+
apitally-0.4.1.dist-info/LICENSE,sha256=vbLzC-4TddtXX-_AFEBKMYWRlxC_MN0g66QhPxo8PgY,1065
|
15
|
+
apitally-0.4.1.dist-info/METADATA,sha256=J-oAJmEw8L92xjTx3rCZhz7xvZWn4QW5PG9GL9eHhpY,6983
|
16
|
+
apitally-0.4.1.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
|
17
|
+
apitally-0.4.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|