Skip to content

Commit d0470a3

Browse files
committed
Use session and remove inline imports in remote_config
Per AI code review feedback: - Use _session.post() instead of requests.post() to maintain retry logic - Remove inline imports (datetime, dateutil.tz already imported at top) - Ensures consistency with other request functions in the module Addresses code review feedback about maintaining session consistency.
1 parent 9906284 commit d0470a3

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

posthog/request.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,6 @@ def remote_config(
139139
timeout: int = 15,
140140
) -> Any:
141141
"""Get remote config flag value from remote_config API endpoint"""
142-
import requests
143-
from datetime import datetime
144-
from dateutil.tz import tzutc
145-
146142
url = remove_trailing_slash(host or DEFAULT_HOST) + f"/api/projects/@current/feature_flags/{key}/remote_config/"
147143

148144
body = {
@@ -158,7 +154,7 @@ def remote_config(
158154

159155
data = json.dumps(body, cls=DatetimeSerializer)
160156

161-
res = requests.post(url, data=data, headers=headers, timeout=timeout)
157+
res = _session.post(url, data=data, headers=headers, timeout=timeout)
162158

163159
return _process_response(
164160
res,

0 commit comments

Comments
 (0)