Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ldclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Config(object):

def __init__(self,
base_uri='https://app.launchdarkly.com',
events_uri='https://events.launchdarkly.com',
connect_timeout=2,
read_timeout=10,
upload_limit=100,
Expand Down Expand Up @@ -54,6 +55,7 @@ def __init__(self,
defaults = {}

self.base_uri = base_uri.rstrip('\\')
self.events_uri = events_uri.rstrip('\\')
self.stream_uri = stream_uri.rstrip('\\')
self.stream = stream
self.stream_processor_class = RequestsStreamProcessor if not stream_processor_class else stream_processor_class
Expand Down
2 changes: 1 addition & 1 deletion ldclient/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def do_send(should_retry):
else:
body = events
hdrs = _headers(self._api_key)
uri = self._config.base_uri + '/api/events/bulk'
uri = self._config.events_uri + '/bulk'
r = self._session.post(uri, headers=hdrs, timeout=(self._config.connect, self._config.read),
data=json.dumps(body))
r.raise_for_status()
Expand Down
2 changes: 1 addition & 1 deletion ldclient/twisted_impls.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def do_send(should_retry):
else:
body = events
hdrs = _headers(self._api_key)
uri = self._config.base_uri + '/api/events/bulk'
uri = self._config.events_uri + '/bulk'
r = yield self._session.post(uri, headers=hdrs, timeout=(self._config.connect, self._config.read),
data=json.dumps(body))
r.raise_for_status()
Expand Down
1 change: 1 addition & 0 deletions testing/server_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def do_nothing(handler):
handler.end_headers()

self.post_paths["/api/events/bulk"] = do_nothing
self.post_paths["/bulk"] = do_nothing
return q

def add_feature(self, key, data):
Expand Down
4 changes: 2 additions & 2 deletions testing/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def fin():

def test_toggle(server):
server.add_feature("foo", feature("foo", "jim")['foo'])
client = LDClient("apikey", Config(base_uri=server.url))
client = LDClient("apikey", Config(base_uri=server.url, events_uri=server.url))
wait_until(lambda: client.toggle("foo", user('xyz'), "blah") == "jim")


def test_sse_init(server, stream):
stream.queue.put(Event(event="put", data=feature("foo", "jim")))
client = LDClient("apikey", Config(
stream=True, base_uri=server.url, stream_uri=stream.url))
stream=True, base_uri=server.url, events_uri=server.url, stream_uri=stream.url))
wait_until(lambda: client.toggle("foo", user('xyz'), "blah") == "jim")


Expand Down