fb-python-sdk 1.1.0__tar.gz → 1.1.2__tar.gz
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.
- {fb-python-sdk-1.1.0/fb_python_sdk.egg-info → fb-python-sdk-1.1.2}/PKG-INFO +4 -4
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/README.md +3 -3
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2/fb_python_sdk.egg-info}/PKG-INFO +4 -4
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fb_python_sdk.egg-info/SOURCES.txt +2 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/client.py +9 -15
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/event_processor.py +23 -11
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/update_processor.py +3 -0
- fb-python-sdk-1.1.2/fbclient/version.py +1 -0
- fb-python-sdk-1.1.2/intergration_tests/readme.py +25 -0
- fb-python-sdk-1.1.2/intergration_tests/run_in_start_no_wait.py +36 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/intergration_tests/run_in_start_wait.py +1 -1
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/setup.py +1 -1
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/tests/test_fbclient.py +8 -3
- fb-python-sdk-1.1.0/fbclient/version.py +0 -1
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/LICENSE +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/MANIFEST.in +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/dev-requirements.txt +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fb_python_sdk.egg-info/dependency_links.txt +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fb_python_sdk.egg-info/requires.txt +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fb_python_sdk.egg-info/top_level.txt +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/__init__.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/category.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/common_types.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/config.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/data_storage.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/evaluator.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/event_types.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/interfaces.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/status.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/status_types.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/streaming.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/utils/__init__.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/utils/exponential_backoff_jitter_strategy.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/utils/http_client.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/utils/repeatable_task.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/utils/rwlock.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/utils/variation_splitting_algorithm.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/intergration_tests/__init__.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/pyproject.toml +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/requirements.txt +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/setup.cfg +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/tests/__init__.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/tests/test_data_storage.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/tests/test_data_update_status_provider.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/tests/test_evaluator.py +0 -0
- {fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/tests/test_event_processor.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fb-python-sdk
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: A Python SDK for FeatBit plateform
|
|
5
5
|
Home-page: https://github.com/featbit/featbit-python-sdk
|
|
6
6
|
Author: Dian SUN
|
|
7
7
|
Author-email: featbit.master@gmail.com
|
|
8
8
|
Project-URL: Code, https://github.com/featbit/featbit-python-sdk
|
|
9
9
|
Project-URL: Issue tracker, https://github.com/featbit/featbit/issues
|
|
10
|
-
Classifier: Development Status ::
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
@@ -62,7 +62,7 @@ from fbclient.config import Config
|
|
|
62
62
|
|
|
63
63
|
env_secret = '<replace-with-your-env-secret>'
|
|
64
64
|
event_url = 'http://localhost:5100'
|
|
65
|
-
streaming_url = '
|
|
65
|
+
streaming_url = 'ws://localhost:5100'
|
|
66
66
|
|
|
67
67
|
set_config(Config(env_secret, event_url, streaming_url))
|
|
68
68
|
client = get()
|
|
@@ -73,7 +73,7 @@ if client.initialize:
|
|
|
73
73
|
user_name = 'bot'
|
|
74
74
|
user = {'key': user_key, 'name': user_name}
|
|
75
75
|
detail = client.variation_detail(flag_key, user, default=None)
|
|
76
|
-
print(f'flag {flag_key} returns {detail.
|
|
76
|
+
print(f'flag {flag_key} returns {detail.variation} for user {user_key}, reason: {detail.reason}')
|
|
77
77
|
|
|
78
78
|
# ensure that the SDK shuts down cleanly and has a chance to deliver events to FeatBit before the program exits
|
|
79
79
|
client.stop()
|
|
@@ -36,7 +36,7 @@ from fbclient.config import Config
|
|
|
36
36
|
|
|
37
37
|
env_secret = '<replace-with-your-env-secret>'
|
|
38
38
|
event_url = 'http://localhost:5100'
|
|
39
|
-
streaming_url = '
|
|
39
|
+
streaming_url = 'ws://localhost:5100'
|
|
40
40
|
|
|
41
41
|
set_config(Config(env_secret, event_url, streaming_url))
|
|
42
42
|
client = get()
|
|
@@ -47,7 +47,7 @@ if client.initialize:
|
|
|
47
47
|
user_name = 'bot'
|
|
48
48
|
user = {'key': user_key, 'name': user_name}
|
|
49
49
|
detail = client.variation_detail(flag_key, user, default=None)
|
|
50
|
-
print(f'flag {flag_key} returns {detail.
|
|
50
|
+
print(f'flag {flag_key} returns {detail.variation} for user {user_key}, reason: {detail.reason}')
|
|
51
51
|
|
|
52
52
|
# ensure that the SDK shuts down cleanly and has a chance to deliver events to FeatBit before the program exits
|
|
53
53
|
client.stop()
|
|
@@ -185,4 +185,4 @@ otherwise, the custom event may not be included into the experiment result.
|
|
|
185
185
|
feature, [submit an issue](https://github.com/featbit/featbit-python-sdk/issues/new).
|
|
186
186
|
|
|
187
187
|
## See Also
|
|
188
|
-
- [Connect To Python Sdk](https://docs.featbit.co/docs/getting-started/4.-connect-an-sdk/server-side-sdks/python-sdk)
|
|
188
|
+
- [Connect To Python Sdk](https://docs.featbit.co/docs/getting-started/4.-connect-an-sdk/server-side-sdks/python-sdk)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fb-python-sdk
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.2
|
|
4
4
|
Summary: A Python SDK for FeatBit plateform
|
|
5
5
|
Home-page: https://github.com/featbit/featbit-python-sdk
|
|
6
6
|
Author: Dian SUN
|
|
7
7
|
Author-email: featbit.master@gmail.com
|
|
8
8
|
Project-URL: Code, https://github.com/featbit/featbit-python-sdk
|
|
9
9
|
Project-URL: Issue tracker, https://github.com/featbit/featbit/issues
|
|
10
|
-
Classifier: Development Status ::
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
@@ -62,7 +62,7 @@ from fbclient.config import Config
|
|
|
62
62
|
|
|
63
63
|
env_secret = '<replace-with-your-env-secret>'
|
|
64
64
|
event_url = 'http://localhost:5100'
|
|
65
|
-
streaming_url = '
|
|
65
|
+
streaming_url = 'ws://localhost:5100'
|
|
66
66
|
|
|
67
67
|
set_config(Config(env_secret, event_url, streaming_url))
|
|
68
68
|
client = get()
|
|
@@ -73,7 +73,7 @@ if client.initialize:
|
|
|
73
73
|
user_name = 'bot'
|
|
74
74
|
user = {'key': user_key, 'name': user_name}
|
|
75
75
|
detail = client.variation_detail(flag_key, user, default=None)
|
|
76
|
-
print(f'flag {flag_key} returns {detail.
|
|
76
|
+
print(f'flag {flag_key} returns {detail.variation} for user {user_key}, reason: {detail.reason}')
|
|
77
77
|
|
|
78
78
|
# ensure that the SDK shuts down cleanly and has a chance to deliver events to FeatBit before the program exits
|
|
79
79
|
client.stop()
|
|
@@ -32,6 +32,8 @@ fbclient/utils/repeatable_task.py
|
|
|
32
32
|
fbclient/utils/rwlock.py
|
|
33
33
|
fbclient/utils/variation_splitting_algorithm.py
|
|
34
34
|
intergration_tests/__init__.py
|
|
35
|
+
intergration_tests/readme.py
|
|
36
|
+
intergration_tests/run_in_start_no_wait.py
|
|
35
37
|
intergration_tests/run_in_start_wait.py
|
|
36
38
|
tests/__init__.py
|
|
37
39
|
tests/test_data_storage.py
|
|
@@ -14,7 +14,6 @@ from fbclient.event_processor import DefaultEventProcessor, NullEventProcessor
|
|
|
14
14
|
from fbclient.event_types import FlagEvent, Metric, MetricEvent, UserEvent
|
|
15
15
|
from fbclient.interfaces import DataUpdateStatusProvider
|
|
16
16
|
from fbclient.status import DataUpdateStatusProviderImpl
|
|
17
|
-
from fbclient.status_types import State
|
|
18
17
|
from fbclient.streaming import Streaming, _data_to_dict
|
|
19
18
|
from fbclient.update_processor import NullUpdateProcessor
|
|
20
19
|
from fbclient.utils import (cast_variation_by_flag_type, check_uwsgi, log,
|
|
@@ -67,7 +66,10 @@ class FBClient:
|
|
|
67
66
|
raise ValueError("Config is not valid")
|
|
68
67
|
|
|
69
68
|
self._config = config
|
|
70
|
-
self._config.
|
|
69
|
+
if self._config.is_offline:
|
|
70
|
+
log.info("FB Python SDK: SDK is in offline mode")
|
|
71
|
+
else:
|
|
72
|
+
self._config.validate()
|
|
71
73
|
|
|
72
74
|
# init components
|
|
73
75
|
# event processor
|
|
@@ -90,15 +92,10 @@ class FBClient:
|
|
|
90
92
|
if not isinstance(self._update_processor, NullUpdateProcessor):
|
|
91
93
|
log.info("FB Python SDK: Waiting for Client initialization in %s seconds" % str(start_wait))
|
|
92
94
|
|
|
93
|
-
if isinstance(self._data_storage, NullDataStorage) or not self._data_storage.initialized:
|
|
94
|
-
log.warning("FB Python SDK: SDK just returns default variation because of no data found in the given environment")
|
|
95
|
-
|
|
96
95
|
update_processor_ready.wait(start_wait)
|
|
97
|
-
if self._config.is_offline:
|
|
98
|
-
log.
|
|
99
|
-
|
|
100
|
-
log.info("FB Python SDK: SDK initialization is completed")
|
|
101
|
-
else:
|
|
96
|
+
if isinstance(self._data_storage, NullDataStorage) or (not self._data_storage.initialized and not self._config.is_offline):
|
|
97
|
+
log.warning("FB Python SDK: SDK just returns default variation because of no data found in the given environment")
|
|
98
|
+
if not self._update_processor.initialized:
|
|
102
99
|
log.warning("FB Python SDK: SDK was not successfully initialized")
|
|
103
100
|
else:
|
|
104
101
|
log.info("FB Python SDK: SDK starts in asynchronous mode")
|
|
@@ -374,13 +371,10 @@ class FBClient:
|
|
|
374
371
|
:param json_str: feature flags, segments...etc in the json format
|
|
375
372
|
:return: True if the initialization is well done
|
|
376
373
|
"""
|
|
377
|
-
if self._config.is_offline
|
|
374
|
+
if self._config.is_offline:
|
|
378
375
|
all_data = json.loads(json_str)
|
|
379
376
|
if valide_all_data(all_data):
|
|
380
377
|
version, data = _data_to_dict(all_data['data'])
|
|
381
|
-
|
|
382
|
-
if res:
|
|
383
|
-
self._update_status_provider.update_state(State.ok_state())
|
|
384
|
-
return res
|
|
378
|
+
return self._update_status_provider.init(data, version)
|
|
385
379
|
|
|
386
380
|
return False
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
from concurrent.futures import ThreadPoolExecutor
|
|
3
3
|
from queue import Empty, Queue
|
|
4
|
-
from threading import BoundedSemaphore, Lock, Thread
|
|
4
|
+
from threading import BoundedSemaphore, Condition, Lock, Thread
|
|
5
5
|
from typing import List, Optional
|
|
6
6
|
|
|
7
7
|
from fbclient.common_types import FBEvent
|
|
@@ -76,7 +76,7 @@ class DefaultEventProcessor(EventProcessor):
|
|
|
76
76
|
log.info('FB Python SDK: event processor is stopping')
|
|
77
77
|
self.__closed = True
|
|
78
78
|
self.__flush_task.stop()
|
|
79
|
-
self.
|
|
79
|
+
self.__put_message_async(MessageType.FLUSH)
|
|
80
80
|
self.__put_message_and_wait_terminate(MessageType.SHUTDOWN)
|
|
81
81
|
|
|
82
82
|
|
|
@@ -94,6 +94,7 @@ class EventDispatcher(Thread):
|
|
|
94
94
|
self.__events_buffer_to_next_flush = []
|
|
95
95
|
self.__flush_workers = ThreadPoolExecutor(max_workers=self.__MAX_FLUSH_WORKERS_NUMBER)
|
|
96
96
|
self.__permits = BoundedSemaphore(value=self.__MAX_FLUSH_WORKERS_NUMBER)
|
|
97
|
+
self.__lock = Condition(Lock())
|
|
97
98
|
|
|
98
99
|
# blocks until at least one message is available and then:
|
|
99
100
|
# 1: transfer the events to event buffer
|
|
@@ -137,6 +138,11 @@ class EventDispatcher(Thread):
|
|
|
137
138
|
self.__events_buffer_to_next_flush.append(event)
|
|
138
139
|
|
|
139
140
|
def __trigger_flush(self):
|
|
141
|
+
def flush_payload_done(fn):
|
|
142
|
+
self.__permits.release()
|
|
143
|
+
with self.__lock:
|
|
144
|
+
self.__lock.notify_all()
|
|
145
|
+
|
|
140
146
|
if not self.__closed and len(self.__events_buffer_to_next_flush) > 0:
|
|
141
147
|
log.debug('trigger flush')
|
|
142
148
|
# get all the current events from event buffer
|
|
@@ -146,21 +152,27 @@ class EventDispatcher(Thread):
|
|
|
146
152
|
# get an available flush worker to send events
|
|
147
153
|
self.__flush_workers \
|
|
148
154
|
.submit(FlushPayloadRunner(self.__config, self.__sender, payloads).run) \
|
|
149
|
-
.add_done_callback(
|
|
155
|
+
.add_done_callback(flush_payload_done)
|
|
150
156
|
# clear the buffer for the next flush
|
|
151
157
|
self.__events_buffer_to_next_flush.clear()
|
|
152
158
|
# if no available flush worker, keep the events in the buffer
|
|
153
159
|
|
|
154
160
|
def __shutdown(self):
|
|
155
161
|
if not self.__closed:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
with self.__lock:
|
|
163
|
+
try:
|
|
164
|
+
log.debug('event dispatcher is cleaning up thread and conn pool')
|
|
165
|
+
self.__wait_until_flush_playload_worker_down()
|
|
166
|
+
self.__closed = True
|
|
167
|
+
log.debug('flush worker pool is stopping...')
|
|
168
|
+
self.__flush_workers.shutdown(wait=True)
|
|
169
|
+
self.__sender.stop()
|
|
170
|
+
except Exception as e:
|
|
171
|
+
log.exception('FB Python SDK: unexpected error when closing event dispatcher: %s' % str(e))
|
|
172
|
+
|
|
173
|
+
def __wait_until_flush_playload_worker_down(self):
|
|
174
|
+
while self.__permits._value != self.__MAX_FLUSH_WORKERS_NUMBER:
|
|
175
|
+
self.__lock.wait()
|
|
164
176
|
|
|
165
177
|
|
|
166
178
|
class FlushPayloadRunner:
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
from threading import Event
|
|
2
2
|
from fbclient.config import Config
|
|
3
3
|
from fbclient.interfaces import DataUpdateStatusProvider, UpdateProcessor
|
|
4
|
+
from fbclient.status_types import State
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class NullUpdateProcessor(UpdateProcessor):
|
|
7
8
|
|
|
8
9
|
def __init__(self, config: Config, dataUpdateStatusProvider: DataUpdateStatusProvider, ready: Event):
|
|
9
10
|
self.__ready = ready
|
|
11
|
+
self.__store = dataUpdateStatusProvider
|
|
10
12
|
|
|
11
13
|
def start(self):
|
|
12
14
|
self.__ready.set()
|
|
15
|
+
self.__store.update_state(State.ok_state())
|
|
13
16
|
|
|
14
17
|
def stop(self):
|
|
15
18
|
pass
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "1.1.2"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from fbclient import get, set_config
|
|
3
|
+
from fbclient.config import Config
|
|
4
|
+
|
|
5
|
+
logging.basicConfig(level=logging.DEBUG,
|
|
6
|
+
format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
|
|
7
|
+
datefmt='%m-%d %H:%M')
|
|
8
|
+
|
|
9
|
+
env_secret = 'fXWjg00OTEa-M_iBCyYiBwFPfdBisjAkiY3ycIMOWw1Q'
|
|
10
|
+
event_url = 'http://localhost:5100'
|
|
11
|
+
streaming_url = 'ws://localhost:5100'
|
|
12
|
+
|
|
13
|
+
set_config(Config(env_secret, event_url, streaming_url))
|
|
14
|
+
client = get()
|
|
15
|
+
|
|
16
|
+
if client.initialize:
|
|
17
|
+
flag_key = 'ff-test-bool'
|
|
18
|
+
user_key = 'user-test-1'
|
|
19
|
+
user_name = 'user-test-1'
|
|
20
|
+
user = {'key': user_key, 'name': user_name}
|
|
21
|
+
detail = client.variation_detail(flag_key, user, default=None)
|
|
22
|
+
print(f'flag {flag_key} returns {detail.variation} for user {user_key}, reason: {detail.reason}')
|
|
23
|
+
|
|
24
|
+
# ensure that the SDK shuts down cleanly and has a chance to deliver events to FeatBit before the program exits
|
|
25
|
+
client.stop()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from time import time
|
|
3
|
+
|
|
4
|
+
from fbclient.client import FBClient
|
|
5
|
+
from fbclient.common_types import FBUser
|
|
6
|
+
from fbclient.config import Config
|
|
7
|
+
from fbclient.utils import log
|
|
8
|
+
|
|
9
|
+
logging.basicConfig(level=logging.DEBUG,
|
|
10
|
+
format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
|
|
11
|
+
datefmt='%m-%d %H:%M')
|
|
12
|
+
|
|
13
|
+
env_secret = 'fXWjg00OTEa-M_iBCyYiBwFPfdBisjAkiY3ycIMOWw1Q'
|
|
14
|
+
|
|
15
|
+
config = Config(env_secret, event_url='http://localhost:5100', streaming_url='ws://localhost:5100')
|
|
16
|
+
client = FBClient(config, start_wait=0)
|
|
17
|
+
|
|
18
|
+
if client.update_status_provider.wait_for_OKState(timeout=15.):
|
|
19
|
+
while True:
|
|
20
|
+
line = input('input user key and flag key seperated by / \n')
|
|
21
|
+
if 'exit' == line.strip():
|
|
22
|
+
break
|
|
23
|
+
try:
|
|
24
|
+
user_key, flag_key, *_ = tuple(line.split('/'))
|
|
25
|
+
user = {'key': user_key, 'name': user_key, 'country': 'cn'}
|
|
26
|
+
fb_user = FBUser.from_dict(user)
|
|
27
|
+
log.info('FB Python SDK Test: user= %s' % fb_user.to_json_str())
|
|
28
|
+
t1 = time()
|
|
29
|
+
log.info('FB Python SDK Test: variation= %s' % client.variation_detail(flag_key, user).to_json_str())
|
|
30
|
+
t2 = time()
|
|
31
|
+
log.info('FB Python SDK Test: execution time= %f' % (t2 - t1))
|
|
32
|
+
except:
|
|
33
|
+
log.exception('FB Python SDK Test: unexpected error')
|
|
34
|
+
break
|
|
35
|
+
|
|
36
|
+
client.stop()
|
|
@@ -10,7 +10,7 @@ logging.basicConfig(level=logging.DEBUG,
|
|
|
10
10
|
format='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
|
|
11
11
|
datefmt='%m-%d %H:%M')
|
|
12
12
|
|
|
13
|
-
env_secret = '
|
|
13
|
+
env_secret = 'fXWjg00OTEa-M_iBCyYiBwFPfdBisjAkiY3ycIMOWw1Q'
|
|
14
14
|
|
|
15
15
|
config = Config(env_secret, event_url='http://localhost:5100', streaming_url='ws://localhost:5100')
|
|
16
16
|
|
|
@@ -39,7 +39,7 @@ setup(
|
|
|
39
39
|
long_description_content_type='text/markdown',
|
|
40
40
|
install_requires=base_reqs,
|
|
41
41
|
classifiers=[
|
|
42
|
-
'Development Status ::
|
|
42
|
+
'Development Status :: 5 - Production/Stable',
|
|
43
43
|
'Intended Audience :: Developers',
|
|
44
44
|
'License :: OSI Approved :: Apache Software License',
|
|
45
45
|
'Operating System :: OS Independent',
|
|
@@ -93,15 +93,20 @@ def test_start_and_timeout(mock_start_method):
|
|
|
93
93
|
assert not client.initialize
|
|
94
94
|
|
|
95
95
|
|
|
96
|
+
def test_start_and_nowait():
|
|
97
|
+
with make_fb_client(NullUpdateProcessor, NullEventProcessor, start_wait=0) as client:
|
|
98
|
+
assert client.update_status_provider.wait_for_OKState(timeout=0.1)
|
|
99
|
+
assert client.initialize
|
|
100
|
+
|
|
101
|
+
|
|
96
102
|
@patch.object(NullUpdateProcessor, "start")
|
|
97
|
-
def
|
|
103
|
+
def test_start_nowait_and_timeout(mock_start_method):
|
|
98
104
|
def start():
|
|
99
105
|
pass
|
|
100
106
|
mock_start_method.side_effect = start
|
|
101
107
|
with make_fb_client(NullUpdateProcessor, NullEventProcessor, start_wait=0) as client:
|
|
102
|
-
assert not client.initialize
|
|
103
|
-
sleep(0.1)
|
|
104
108
|
assert not client.update_status_provider.wait_for_OKState(timeout=0.1)
|
|
109
|
+
assert not client.initialize
|
|
105
110
|
|
|
106
111
|
|
|
107
112
|
@patch.object(NullUpdateProcessor, "start")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "1.1.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fb-python-sdk-1.1.0 → fb-python-sdk-1.1.2}/fbclient/utils/exponential_backoff_jitter_strategy.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|