Skip to content

Commit 3bb3d7b

Browse files
romanzdkRoman Zydyk
andauthored
Use logging instead of print (#947)
Co-authored-by: Roman Zydyk <[email protected]>
1 parent a3356d8 commit 3bb3d7b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

polygon/rest/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ def _get(
113113
print_headers["Authorization"] = print_headers["Authorization"].replace(
114114
self.API_KEY, "REDACTED"
115115
)
116-
print(f"Request URL: {full_url}")
117-
print(f"Request Headers: {print_headers}")
116+
logger.info("Request URL: %s", full_url)
117+
logger.info("Request Headers: %s", print_headers)
118118

119119
resp = self.client.request(
120120
"GET",
@@ -125,7 +125,7 @@ def _get(
125125

126126
if self.trace:
127127
resp_headers_dict = dict(resp.headers.items())
128-
print(f"Response Headers: {resp_headers_dict}")
128+
logger.info("Response Headers: %s", resp_headers_dict)
129129

130130
if resp.status != 200:
131131
raise BadResponse(resp.data.decode("utf-8"))
@@ -136,7 +136,7 @@ def _get(
136136
try:
137137
obj = self._decode(resp)
138138
except ValueError as e:
139-
print(f"Error decoding json response: {e}")
139+
logger.error("Error decoding json response: %s", e)
140140
return []
141141

142142
if result_key:
@@ -222,7 +222,7 @@ def _paginate_iter(
222222
try:
223223
decoded = self._decode(resp)
224224
except ValueError as e:
225-
print(f"Error decoding json response: {e}")
225+
logger.error("Error decoding json response: %s", e)
226226
return []
227227

228228
if result_key not in decoded:

0 commit comments

Comments
 (0)