Skip to content

Commit 6efdf71

Browse files
committed
reorder get_session
1 parent 96b8d73 commit 6efdf71

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/shared.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ def __init__(self, message, exit_code=None):
3535

3636
def get_session(accept_header=None):
3737
"""Create a reusable HTTP session with retry logic."""
38+
session = Session()
39+
3840
retry_strategy = Retry(
3941
total=5,
4042
backoff_factor=10,
4143
status_forcelist=STATUS_FORCELIST,
4244
)
43-
44-
session = Session()
45+
session.mount("https://", HTTPAdapter(max_retries=retry_strategy))
4546

4647
headers = {"User-Agent": USER_AGENT}
4748
if accept_header:
4849
headers["accept"] = accept_header
4950
session.headers.update(headers)
5051

51-
session.mount("https://", HTTPAdapter(max_retries=retry_strategy))
5252
return session
5353

5454

0 commit comments

Comments
 (0)