File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99from requests_futures .sessions import FuturesSession # type: ignore
1010
11- from flagsmith .version import __version__
11+ from flagsmith .version import DEFAULT_USER_AGENT , __version__
1212
1313logger = logging .getLogger (__name__ )
1414
@@ -218,7 +218,7 @@ def flush(self) -> None:
218218 headers = {
219219 "Content-Type" : "application/json; charset=utf-8" ,
220220 "X-Environment-Key" : self ._environment_key ,
221- "Flagsmith-SDK-User-Agent" : f"flagsmith-python-client/ { __version__ } " ,
221+ "Flagsmith-SDK-User-Agent" : DEFAULT_USER_AGENT ,
222222 },
223223 )
224224 except RuntimeError :
Original file line number Diff line number Diff line change 4141 TraitMapping ,
4242)
4343from flagsmith .utils .identities import generate_identity_data
44- from flagsmith .version import __version__
44+ from flagsmith .version import DEFAULT_USER_AGENT
4545
4646logger = logging .getLogger (__name__ )
4747
4848DEFAULT_API_URL = "https://edge.api.flagsmith.com/api/v1/"
4949DEFAULT_REALTIME_API_URL = "https://realtime.flagsmith.com/"
50- DEFAULT_USER_AGENT = f"flagsmith-python-sdk/{ __version__ } "
5150
5251
5352class Flagsmith :
Original file line number Diff line number Diff line change 11from importlib .metadata import version
22
33__version__ = version ("flagsmith" )
4+
5+ DEFAULT_USER_AGENT = f"flagsmith-python-sdk/{ __version__ } "
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ def test_flush_sends_correct_http_request(event_processor: EventProcessor) -> No
171171 headers = call_kwargs [1 ]["headers" ]
172172 assert headers ["X-Environment-Key" ] == "test_key"
173173 assert headers ["Content-Type" ] == "application/json; charset=utf-8"
174- assert "flagsmith-python-client /" in headers ["Flagsmith-SDK-User-Agent" ]
174+ assert "flagsmith-python-sdk /" in headers ["Flagsmith-SDK-User-Agent" ]
175175
176176 body = json .loads (call_kwargs [1 ]["data" ])
177177 assert "environment_key" not in body
You can’t perform that action at this time.
0 commit comments