From 054b2695ec4cc486007b80000b13931ef5665ce4 Mon Sep 17 00:00:00 2001 From: zack <43246297+clickingbuttons@users.noreply.github.com> Date: Thu, 5 May 2022 11:26:45 -0400 Subject: [PATCH] add certifi --- poetry.lock | 16 ++++++++++++++-- polygon/rest/base.py | 9 +++++++-- pyproject.toml | 2 ++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index a4545c5d..a2f944c7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -44,7 +44,7 @@ uvloop = ["uvloop (>=0.15.2)"] name = "certifi" version = "2021.10.8" description = "Python package for providing Mozilla's CA Bundle." -category = "dev" +category = "main" optional = false python-versions = "*" @@ -410,6 +410,14 @@ category = "dev" optional = false python-versions = ">=3.6" +[[package]] +name = "types-certifi" +version = "2021.10.8.2" +description = "Typing stubs for certifi" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "types-urllib3" version = "1.26.14" @@ -462,7 +470,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "b818dd9062a6e24f8c3d4af8d9b0706681460e65604b22e2efe2c87f496b33d9" +content-hash = "1379de274d70d2c1cdd4b08e81887e35e0b7d0b0fbca08168005fe6b430c5e93" [metadata.files] alabaster = [ @@ -706,6 +714,10 @@ typed-ast = [ {file = "typed_ast-1.5.3-cp39-cp39-win_amd64.whl", hash = "sha256:20d5118e494478ef2d3a2702d964dae830aedd7b4d3b626d003eea526be18718"}, {file = "typed_ast-1.5.3.tar.gz", hash = "sha256:27f25232e2dd0edfe1f019d6bfaaf11e86e657d9bdb7b0956db95f560cceb2b3"}, ] +types-certifi = [ + {file = "types-certifi-2021.10.8.2.tar.gz", hash = "sha256:a36dc1cb4aeeea8c97430297db10b4c0481ba612ed443e48e3e8aa091f359440"}, + {file = "types_certifi-2021.10.8.2-py3-none-any.whl", hash = "sha256:d8d61752071a10747f441c169967e31d43c1875d851973f4f9851c1cb8c5ed9d"}, +] types-urllib3 = [ {file = "types-urllib3-1.26.14.tar.gz", hash = "sha256:2a2578e4b36341ccd240b00fccda9826988ff0589a44ba4a664bbd69ef348d27"}, {file = "types_urllib3-1.26.14-py3-none-any.whl", hash = "sha256:5d2388aa76395b1e3999ff789ea5b3283677dad8e9bcf3d9117ba19271fd35d9"}, diff --git a/polygon/rest/base.py b/polygon/rest/base.py index 1cecfa18..f1609e1d 100644 --- a/polygon/rest/base.py +++ b/polygon/rest/base.py @@ -1,4 +1,4 @@ -import os +import certifi import json import urllib3 import inspect @@ -33,6 +33,8 @@ def __init__( "Authorization": "Bearer " + self.API_KEY, "User-Agent": "Python client", }, + ca_certs=certifi.where(), + cert_reqs="CERT_REQUIRED", ) self.timeout = urllib3.Timeout(connect=connect_timeout, read=read_timeout) self.retries = retries @@ -55,7 +57,10 @@ def _get( if self.verbose: print("_get", path, params) resp = self.client.request( - "GET", self.BASE + path, fields=params, retries=self.retries + "GET", + self.BASE + path, + fields=params, + retries=self.retries, ) if resp.status != 200: diff --git a/pyproject.toml b/pyproject.toml index 4a892fc9..d8752059 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ packages = [ python = "^3.7" urllib3 = "^1.26.9" websockets = "^10.3" +certifi = "^2021.10.8" [tool.poetry.dev-dependencies] black = "^22.3.0" @@ -37,6 +38,7 @@ Sphinx = "^4.5.0" sphinx-rtd-theme = "^1.0.0" # keep this in sync with docs/requirements.txt for readthedocs.org sphinx-autodoc-typehints = "^1.18.1" +types-certifi = "^2021.10.8" [build-system] requires = ["poetry-core>=1.0.0"]