Skip to content

Commit 9cc98d8

Browse files
authored
Merge pull request #2 from launchdarkly/pk/missing-key-warning
Avoid logging a warning for a missing sdk key when importing ldclient…
2 parents b9c2eee + 59e763a commit 9cc98d8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ldclient/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def __init__(self, sdk_key=None, config=None, start_wait=5):
3939
self._config = Config(sdk_key=sdk_key)
4040
else:
4141
self._config = config or Config.default()
42+
self._config._validate()
4243

4344
self._session = CacheControl(requests.Session())
4445
self._queue = queue.Queue(self._config.events_max_pending)

ldclient/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ def __init__(self,
3939
:param event_consumer_class: A factory for an EventConsumer implementation taking the event queue, sdk key, and config
4040
:type event_consumer_class: (queue.Queue, str, Config) -> EventConsumer
4141
"""
42-
if offline is False and sdk_key is None or sdk_key is '':
43-
log.warn("Missing or blank sdk_key.")
4442
self.__sdk_key = sdk_key
4543

4644
if defaults is None:
@@ -168,3 +166,7 @@ def verify_ssl(self):
168166
@property
169167
def offline(self):
170168
return self.__offline
169+
170+
def _validate(self):
171+
if self.offline is False and self.sdk_key is None or self.sdk_key is '':
172+
log.warn("Missing or blank sdk_key.")

0 commit comments

Comments
 (0)