Added created_at to session metadata
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import requests
|
import requests
|
||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
from .request import buildRequest
|
from .request import buildRequest
|
||||||
|
|
||||||
#session = requests.Session()
|
#session = requests.Session()
|
||||||
@@ -15,6 +16,7 @@ def getSession(reset=False):
|
|||||||
if not hasattr(_thread_local, "session"):
|
if not hasattr(_thread_local, "session"):
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
session.name = threading.current_thread().name
|
session.name = threading.current_thread().name
|
||||||
|
session.created_at = time.monotonic()
|
||||||
_thread_local.session = session
|
_thread_local.session = session
|
||||||
|
|
||||||
return _thread_local.session
|
return _thread_local.session
|
||||||
@@ -23,7 +25,7 @@ def getSession(reset=False):
|
|||||||
def executeRequest(action, outputs, resolved):
|
def executeRequest(action, outputs, resolved):
|
||||||
session = getSession()
|
session = getSession()
|
||||||
|
|
||||||
session_log = bool(os.environ.get("LOGS_SESSION", False))
|
session_log = os.environ.get("LOGS_SESSION", "false").lower() == "true"
|
||||||
|
|
||||||
if session_log:
|
if session_log:
|
||||||
print(
|
print(
|
||||||
|
|||||||
Reference in New Issue
Block a user