growthbook 1.4.0__py2.py3-none-any.whl → 1.4.1__py2.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.
- growthbook/__init__.py +1 -1
- growthbook/growthbook.py +10 -5
- {growthbook-1.4.0.dist-info → growthbook-1.4.1.dist-info}/METADATA +1 -1
- {growthbook-1.4.0.dist-info → growthbook-1.4.1.dist-info}/RECORD +7 -7
- {growthbook-1.4.0.dist-info → growthbook-1.4.1.dist-info}/WHEEL +0 -0
- {growthbook-1.4.0.dist-info → growthbook-1.4.1.dist-info}/licenses/LICENSE +0 -0
- {growthbook-1.4.0.dist-info → growthbook-1.4.1.dist-info}/top_level.txt +0 -0
growthbook/__init__.py
CHANGED
growthbook/growthbook.py
CHANGED
|
@@ -120,12 +120,13 @@ class InMemoryStickyBucketService(AbstractStickyBucketService):
|
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
class SSEClient:
|
|
123
|
-
def __init__(self, api_host, client_key, on_event, reconnect_delay=5, headers=None):
|
|
123
|
+
def __init__(self, api_host, client_key, on_event, reconnect_delay=5, headers=None, timeout = 30):
|
|
124
124
|
self.api_host = api_host
|
|
125
125
|
self.client_key = client_key
|
|
126
126
|
|
|
127
127
|
self.on_event = on_event
|
|
128
128
|
self.reconnect_delay = reconnect_delay
|
|
129
|
+
self.timeout = timeout
|
|
129
130
|
|
|
130
131
|
self._sse_session = None
|
|
131
132
|
self._sse_thread = None
|
|
@@ -173,7 +174,8 @@ class SSEClient:
|
|
|
173
174
|
|
|
174
175
|
while self.is_running:
|
|
175
176
|
try:
|
|
176
|
-
async with aiohttp.ClientSession(headers=self.headers
|
|
177
|
+
async with aiohttp.ClientSession(headers=self.headers,
|
|
178
|
+
timeout=aiohttp.ClientTimeout(total=self.timeout)) as session:
|
|
177
179
|
self._sse_session = session
|
|
178
180
|
|
|
179
181
|
async with session.get(url) as response:
|
|
@@ -407,10 +409,10 @@ class FeatureRepository(object):
|
|
|
407
409
|
return data
|
|
408
410
|
|
|
409
411
|
|
|
410
|
-
def startAutoRefresh(self, api_host, client_key, cb):
|
|
412
|
+
def startAutoRefresh(self, api_host, client_key, cb, streaming_timeout=30):
|
|
411
413
|
if not client_key:
|
|
412
414
|
raise ValueError("Must specify `client_key` to start features streaming")
|
|
413
|
-
self.sse_client = self.sse_client or SSEClient(api_host=api_host, client_key=client_key, on_event=cb)
|
|
415
|
+
self.sse_client = self.sse_client or SSEClient(api_host=api_host, client_key=client_key, on_event=cb, timeout=streaming_timeout)
|
|
414
416
|
self.sse_client.connect()
|
|
415
417
|
|
|
416
418
|
def stopAutoRefresh(self):
|
|
@@ -443,6 +445,7 @@ class GrowthBook(object):
|
|
|
443
445
|
sticky_bucket_identifier_attributes: List[str] = None,
|
|
444
446
|
savedGroups: dict = {},
|
|
445
447
|
streaming: bool = False,
|
|
448
|
+
streaming_timeout: int = 30,
|
|
446
449
|
plugins: List = None,
|
|
447
450
|
# Deprecated args
|
|
448
451
|
trackingCallback=None,
|
|
@@ -471,6 +474,7 @@ class GrowthBook(object):
|
|
|
471
474
|
self._trackingCallback = on_experiment_viewed or trackingCallback
|
|
472
475
|
|
|
473
476
|
self._streaming = streaming
|
|
477
|
+
self._streaming_timeout = streaming_timeout
|
|
474
478
|
|
|
475
479
|
# Deprecated args
|
|
476
480
|
self._user = user
|
|
@@ -587,7 +591,8 @@ class GrowthBook(object):
|
|
|
587
591
|
feature_repo.startAutoRefresh(
|
|
588
592
|
api_host=self._api_host,
|
|
589
593
|
client_key=self._client_key,
|
|
590
|
-
cb=self._dispatch_sse_event
|
|
594
|
+
cb=self._dispatch_sse_event,
|
|
595
|
+
streaming_timeout=self._streaming_timeout
|
|
591
596
|
)
|
|
592
597
|
|
|
593
598
|
def stopAutoRefresh(self):
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
growthbook/__init__.py,sha256=
|
|
1
|
+
growthbook/__init__.py,sha256=wx8DI5CN6we3wD2KfxR9CgroKfiiF7LQSQuqdrzQyjw,444
|
|
2
2
|
growthbook/common_types.py,sha256=OUGkqoUuYetWz1cyA1eWz5DM3awYw_ExcNAjFqJuGAc,14881
|
|
3
3
|
growthbook/core.py,sha256=n9nwna26iZTY48LIvQqu5N_RrE35X0wlRBhq0-Qdb-s,35241
|
|
4
|
-
growthbook/growthbook.py,sha256=
|
|
4
|
+
growthbook/growthbook.py,sha256=oxjXeGkYOU164miEcZzTFPCgMJrcCB_XHCB7IOOabFM,31037
|
|
5
5
|
growthbook/growthbook_client.py,sha256=1bDIuJoxlKUR_bKe_gD6V7JlUPt53uGgix9DhgSkPPc,23360
|
|
6
6
|
growthbook/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
growthbook/plugins/__init__.py,sha256=y2eAV1sA041XWcftBVTDH0t-ggy9r2C5oKRYRF6XR6s,602
|
|
8
8
|
growthbook/plugins/base.py,sha256=PWBXUBj62hi25Y5Eif9WmEWagWdkwGXHi2dMtn44bo8,3637
|
|
9
9
|
growthbook/plugins/growthbook_tracking.py,sha256=FvPFOuKF_xKjmTX8x_hzMlHrrL-68Y2ZPw1Hfl2_ilQ,11333
|
|
10
10
|
growthbook/plugins/request_context.py,sha256=O5FJDrjJR5u0rx3ENGO9cOsKMHd9e0l0Nvdb1PHfmm8,12951
|
|
11
|
-
growthbook-1.4.
|
|
12
|
-
growthbook-1.4.
|
|
13
|
-
growthbook-1.4.
|
|
14
|
-
growthbook-1.4.
|
|
15
|
-
growthbook-1.4.
|
|
11
|
+
growthbook-1.4.1.dist-info/licenses/LICENSE,sha256=D-TcBckB0dTPUlNJ8jBiTIJIj1ekHLB1CY7HJtJKhMY,1069
|
|
12
|
+
growthbook-1.4.1.dist-info/METADATA,sha256=G1jZbYb7vuJL1FIo2gdBimQVFwuoGI-JLvd4dJGZxLQ,22073
|
|
13
|
+
growthbook-1.4.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
14
|
+
growthbook-1.4.1.dist-info/top_level.txt,sha256=dzfRQFGYejCIUstRSrrRVTMlxf7pBqASTI5S8gGRlXw,11
|
|
15
|
+
growthbook-1.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|