Skip to content

Commit b6a62ed

Browse files
authored
improvement/naming tweaks (#21)
* improvement/naming-tweaks * Tweaks
1 parent ff243ca commit b6a62ed

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

.isort.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ use_parentheses=true
33
multi_line_output=3
44
include_trailing_comma=true
55
line_length=79
6-
known_third_party = pytest,requests,requests_futures,setuptools
6+
known_third_party = flag_engine,flask,pytest,requests,requests_futures,responses

flagsmith/flagsmith.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def __init__(
2626
environment_key: str,
2727
api_url: str = DEFAULT_API_URL,
2828
custom_headers: typing.Dict[str, typing.Any] = None,
29-
request_timeout: int = None,
30-
enable_client_side_evaluation: bool = False,
29+
request_timeout_seconds: int = None,
30+
enable_local_evaluation: bool = False,
3131
environment_refresh_interval_seconds: int = 60,
3232
retries: Retry = None,
3333
enable_analytics: bool = False,
@@ -40,15 +40,15 @@ def __init__(
4040
retries = retries or Retry(total=3, backoff_factor=0.1)
4141

4242
self.api_url = api_url if api_url.endswith("/") else f"{api_url}/"
43-
self.request_timeout = request_timeout
43+
self.request_timeout_seconds = request_timeout_seconds
4444
self.session.mount(self.api_url, HTTPAdapter(max_retries=retries))
4545

4646
self.environment_flags_url = f"{self.api_url}flags/"
4747
self.identities_url = f"{self.api_url}identities/"
4848
self.environment_url = f"{self.api_url}environment-document/"
4949

5050
self._environment = None
51-
if enable_client_side_evaluation:
51+
if enable_local_evaluation:
5252
self.environment_data_polling_manager_thread = (
5353
EnvironmentDataPollingManager(
5454
main=self,
@@ -59,7 +59,7 @@ def __init__(
5959

6060
self._analytics_processor = (
6161
AnalyticsProcessor(
62-
environment_key, self.api_url, timeout=self.request_timeout
62+
environment_key, self.api_url, timeout=self.request_timeout_seconds
6363
)
6464
if enable_analytics
6565
else None
@@ -151,7 +151,9 @@ def _get_identity_flags_from_api(
151151
def _get_json_response(self, url: str, method: str, body: dict = None):
152152
try:
153153
request_method = getattr(self.session, method.lower())
154-
response = request_method(url, json=body, timeout=self.request_timeout)
154+
response = request_method(
155+
url, json=body, timeout=self.request_timeout_seconds
156+
)
155157
if response.status_code != 200:
156158
raise FlagsmithAPIError(
157159
"Invalid request made to Flagsmith API. Response status code: %d",

tests/test_flagsmith.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_flagsmith_starts_polling_manager_on_init_if_enabled(mocker, api_key):
2020
)
2121

2222
# When
23-
Flagsmith(environment_key=api_key, enable_client_side_evaluation=True)
23+
Flagsmith(environment_key=api_key, enable_local_evaluation=True)
2424

2525
# Then
2626
mock_polling_manager.start.assert_called_once()

0 commit comments

Comments
 (0)