From 83a60590adcdc9245c058b2da3ba1dbb3ae6b167 Mon Sep 17 00:00:00 2001 From: Austin Gregory Date: Wed, 4 Sep 2024 16:28:08 -0400 Subject: [PATCH] Use a fresh connection on every request --- nylas/handler/http_client.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nylas/handler/http_client.py b/nylas/handler/http_client.py index 2d9ace51..5b1d77ab 100644 --- a/nylas/handler/http_client.py +++ b/nylas/handler/http_client.py @@ -70,7 +70,6 @@ def __init__(self, api_server, api_key, timeout): self.api_server = api_server self.api_key = api_key self.timeout = timeout - self.session = requests.Session() def _execute( self, @@ -90,7 +89,7 @@ def _execute( if overrides and overrides.get("timeout"): timeout = overrides["timeout"] try: - response = self.session.request( + response = requests.request( request["method"], request["url"], headers=request["headers"], @@ -117,7 +116,7 @@ def _execute_download_request( if overrides and overrides.get("timeout"): timeout = overrides["timeout"] try: - response = self.session.request( + response = requests.request( request["method"], request["url"], headers=request["headers"],