Introduced per session threading tio prevent session collisions and Connection Reset errors

This commit is contained in:
Lyncoln
2026-10-23 22:06:50 -04:00
parent 084a98c114
commit 90ec6fcd22
+19 -1
View File
@@ -1,10 +1,28 @@
import requests
import threading
from .request import buildRequest
session = requests.Session()
#session = requests.Session()
_thread_local = threading.local()
def getSession():
if not hasattr(_thread_local, "session"):
session = requests.Session()
session.name = threading.current_thread().name
_thread_local.session = session
return _thread_local.session
def executeRequest(action, outputs, resolved):
session = getSession()
print(
f"Session {session.name} used by "
f"{threading.current_thread().name} thread"
)
request, outputs = buildRequest(action, outputs, resolved)
response = session.request(