Skip to content

Commit

Permalink
chore: swap core for yggdrasil (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
sighphyre authored Nov 18, 2024
1 parent fd59b80 commit fa88e22
Show file tree
Hide file tree
Showing 52 changed files with 333 additions and 2,540 deletions.
319 changes: 111 additions & 208 deletions UnleashClient/__init__.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions UnleashClient/api/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_feature_toggles(
request_retries: int,
project: Optional[str] = None,
cached_etag: str = "",
) -> Tuple[dict, str]:
) -> Tuple[str, str]:
"""
Retrieves feature flags from unleash central server.
Expand Down Expand Up @@ -82,10 +82,10 @@ def get_feature_toggles(
if resp.status_code == 304:
return None, etag

return resp.json(), etag
return resp.text, etag
except Exception as exc:
LOGGER.exception(
"Unleash Client feature fetch failed due to exception: %s", exc
)

return {}, ""
return None, ""
3 changes: 2 additions & 1 deletion UnleashClient/api/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from platform import python_implementation, python_version

import requests
import yggdrasil_engine
from requests.exceptions import InvalidHeader, InvalidSchema, InvalidURL, MissingSchema

from UnleashClient.constants import (
Expand Down Expand Up @@ -52,7 +53,7 @@ def register_client(
"interval": metrics_interval,
"platformName": python_implementation(),
"platformVersion": python_version(),
"yggdrasilVersion": None,
"yggdrasilVersion": yggdrasil_engine.__yggdrasil_core_version__,
"specVersion": CLIENT_SPEC_VERSION,
}

Expand Down
6 changes: 3 additions & 3 deletions UnleashClient/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def bootstrap_from_dict(self, initial_config: dict) -> None:
:param initial_config: Dictionary that contains initial configuration.
"""
self.set(FEATURES_URL, initial_config)
self.set(FEATURES_URL, json.dumps(initial_config))
self.bootstrapped = True

def bootstrap_from_file(self, initial_config_file: Path) -> None:
Expand All @@ -103,7 +103,7 @@ def bootstrap_from_file(self, initial_config_file: Path) -> None:
:param initial_configuration_file: Path to document containing initial configuration. Must be JSON.
"""
with open(initial_config_file, "r", encoding="utf8") as bootstrap_file:
self.set(FEATURES_URL, json.loads(bootstrap_file.read()))
self.set(FEATURES_URL, bootstrap_file.read())
self.bootstrapped = True

def bootstrap_from_url(
Expand All @@ -122,7 +122,7 @@ def bootstrap_from_url(
"""
timeout = request_timeout if request_timeout else self.request_timeout
response = requests.get(initial_config_url, headers=headers, timeout=timeout)
self.set(FEATURES_URL, response.json())
self.set(FEATURES_URL, response.text)
self.bootstrapped = True

def set(self, key: str, value: Any):
Expand Down
266 changes: 0 additions & 266 deletions UnleashClient/constraints/Constraint.py

This file was deleted.

2 changes: 0 additions & 2 deletions UnleashClient/constraints/__init__.py

This file was deleted.

20 changes: 0 additions & 20 deletions UnleashClient/deprecation_warnings.py

This file was deleted.

Loading

0 comments on commit fa88e22

Please sign in to comment.