Skip to content

Avoid module-level requests.Session instances#981

Open
LeMyst wants to merge 1 commit into
masterfrom
improve-sessions
Open

Avoid module-level requests.Session instances#981
LeMyst wants to merge 1 commit into
masterfrom
improve-sessions

Conversation

@LeMyst

@LeMyst LeMyst commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Remove shared module-level Session objects and use local Session instances per call to avoid shared state and potential side-effects. Replaced helpers_session/default_session with per-call requests.Session() or the provided session argument in mediawiki_api_call, execute_sparql_query, and download_entity_ttl. Keeps behavior the same while preventing reuse of a global session across unrelated requests and reducing risk of stale connections or unintended cookies/headers being shared.

Remove shared module-level Session objects and use local Session instances per call to avoid shared state and potential side-effects. Replaced helpers_session/default_session with per-call requests.Session() or the provided session argument in mediawiki_api_call, execute_sparql_query, and download_entity_ttl. Keeps behavior the same while preventing reuse of a global session across unrelated requests and reducing risk of stale connections or unintended cookies/headers being shared.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant