From ce7b20e689f1174e76dccb2fec894cedf1caefcb Mon Sep 17 00:00:00 2001 From: Razvan Date: Wed, 26 Jan 2022 22:34:07 -0500 Subject: [PATCH 1/4] Add UTF8 validation skipping & ignore SSL (attempt to fix disconnects) --- polygon/websocket/websocket_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polygon/websocket/websocket_client.py b/polygon/websocket/websocket_client.py index 3c046485..8ca7226a 100644 --- a/polygon/websocket/websocket_client.py +++ b/polygon/websocket/websocket_client.py @@ -43,7 +43,7 @@ def __init__(self, cluster: str, auth_key: str, process_message: Optional[Callab signal.signal(signal.SIGTERM, self._cleanup_signal_handler()) def run(self): - self.ws.run_forever() + self.ws.run_forever(skip_utf8_validation=True, sslopt={"cert_reqs": ssl.CERT_NONE}) def run_async(self): self._run_thread = threading.Thread(target=self.run) From 0793e633939352597c992541225df85dc6e6161e Mon Sep 17 00:00:00 2001 From: Razvan Date: Wed, 26 Jan 2022 22:43:29 -0500 Subject: [PATCH 2/4] Fix missing version error --- setup.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 45095315..fd16d732 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,6 @@ import os import sys -version = os.getenv("VERSION") -if not version: - print("no version supplied") - sys.exit(1) - def get_readme_md_contents(): """read the contents of your README file""" with open("README.md", encoding='utf-8') as f: @@ -18,7 +13,7 @@ def get_readme_md_contents(): setup( name="polygon-api-client", - version=version, + version=0.9, description="Polygon API client", long_description=get_readme_md_contents(), long_description_content_type="text/markdown", From 5860b6ad36225c033281c02b4938c7e05882b1bf Mon Sep 17 00:00:00 2001 From: Razvan Date: Wed, 26 Jan 2022 22:45:59 -0500 Subject: [PATCH 3/4] Add ssl import --- polygon/websocket/websocket_client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/polygon/websocket/websocket_client.py b/polygon/websocket/websocket_client.py index 8ca7226a..4221f8c4 100644 --- a/polygon/websocket/websocket_client.py +++ b/polygon/websocket/websocket_client.py @@ -1,4 +1,5 @@ import signal +import ssl import threading from typing import Optional, Callable From c64e4b9a13629b1d8af8c526f3750ec1898952f0 Mon Sep 17 00:00:00 2001 From: Razvan Date: Sun, 20 Mar 2022 23:43:58 -0400 Subject: [PATCH 4/4] Remove signalling since sub-thread --- polygon/websocket/websocket_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polygon/websocket/websocket_client.py b/polygon/websocket/websocket_client.py index 4221f8c4..fae2d0c5 100644 --- a/polygon/websocket/websocket_client.py +++ b/polygon/websocket/websocket_client.py @@ -40,8 +40,8 @@ def __init__(self, cluster: str, auth_key: str, process_message: Optional[Callab # TODO: this probably isn't great design. # If the user defines their own signal handler then this will gets overwritten. # We still need to make sure that killing, terminating, interrupting the program closes the connection - signal.signal(signal.SIGINT, self._cleanup_signal_handler()) - signal.signal(signal.SIGTERM, self._cleanup_signal_handler()) + # signal.signal(signal.SIGINT, self._cleanup_signal_handler()) + # signal.signal(signal.SIGTERM, self._cleanup_signal_handler()) def run(self): self.ws.run_forever(skip_utf8_validation=True, sslopt={"cert_reqs": ssl.CERT_NONE})