From fe23558468a0a106c482a2720eab220a352c74ba Mon Sep 17 00:00:00 2001 From: zack <43246297+clickingbuttons@users.noreply.github.com> Date: Fri, 29 Apr 2022 10:26:10 -0400 Subject: [PATCH 1/2] add user agent string --- polygon/rest/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/polygon/rest/base.py b/polygon/rest/base.py index 18293c26..c446010d 100644 --- a/polygon/rest/base.py +++ b/polygon/rest/base.py @@ -31,7 +31,10 @@ def __init__( # https://urllib3.readthedocs.io/en/stable/reference/urllib3.poolmanager.html # https://urllib3.readthedocs.io/en/stable/reference/urllib3.connectionpool.html#urllib3.HTTPConnectionPool self.client = urllib3.PoolManager( - num_pools=num_pools, headers={"Authorization": "Bearer " + self.API_KEY} + num_pools=num_pools, headers={ + "Authorization": "Bearer " + self.API_KEY, + "User-Agent": "Python client" + } ) self.timeout = urllib3.Timeout(connect=connect_timeout, read=read_timeout) self.retries = retries From f6488a8ca835ecd11a6091fe9d3c7e8190fd297d Mon Sep 17 00:00:00 2001 From: zack <43246297+clickingbuttons@users.noreply.github.com> Date: Fri, 29 Apr 2022 10:30:41 -0400 Subject: [PATCH 2/2] lint --- polygon/rest/base.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/polygon/rest/base.py b/polygon/rest/base.py index c446010d..f719a8e9 100644 --- a/polygon/rest/base.py +++ b/polygon/rest/base.py @@ -31,10 +31,11 @@ def __init__( # https://urllib3.readthedocs.io/en/stable/reference/urllib3.poolmanager.html # https://urllib3.readthedocs.io/en/stable/reference/urllib3.connectionpool.html#urllib3.HTTPConnectionPool self.client = urllib3.PoolManager( - num_pools=num_pools, headers={ + num_pools=num_pools, + headers={ "Authorization": "Bearer " + self.API_KEY, - "User-Agent": "Python client" - } + "User-Agent": "Python client", + }, ) self.timeout = urllib3.Timeout(connect=connect_timeout, read=read_timeout) self.retries = retries