From 3bdbe59d89f40277d5219d14b9a142fae7927859 Mon Sep 17 00:00:00 2001 From: Yusuf Date: Wed, 29 Mar 2023 17:04:02 +0200 Subject: [PATCH] Fixed cookie value replacement, added debug possibility --- tls_client/sessions.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tls_client/sessions.py b/tls_client/sessions.py index 72e3ef5..619c652 100644 --- a/tls_client/sessions.py +++ b/tls_client/sessions.py @@ -35,6 +35,7 @@ def __init__( random_tls_extension_order: Optional = False, force_http1: Optional = False, catch_panics: Optional = False, + debug: Optional = False ) -> None: self._session_id = str(uuid.uuid4()) # --- Standard Settings ---------------------------------------------------------------------------------------- @@ -264,6 +265,9 @@ def __init__( # avoid the tls client to print the whole stacktrace when a panic (critical go error) happens self.catch_panics = catch_panics + # debugging + self.debug = debug + def execute_request( self, method: str, @@ -318,7 +322,7 @@ def execute_request( cookies = merge_cookies(self.cookies, cookies) # turn cookie jar into dict request_cookies = [ - {'domain': c.domain, 'expires': c.expires, 'name': c.name, 'path': c.path, 'value': c.value} + {'domain': c.domain, 'expires': c.expires, 'name': c.name, 'path': c.path, 'value': c.value.replace('"', "")} for c in cookies ] @@ -338,6 +342,7 @@ def execute_request( "sessionId": self._session_id, "followRedirects": allow_redirects, "forceHttp1": self.force_http1, + "withDebug": self.debug, "catchPanics": self.catch_panics, "headers": dict(headers), "headerOrder": self.header_order,