Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Polygon API key authentication URL #4748

Merged
merged 4 commits into from
Apr 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions openbb_terminal/keys_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io
import logging
import sys
from datetime import date
from enum import Enum
from typing import Dict, List, Union

Expand Down Expand Up @@ -542,9 +543,10 @@ def check_polygon_key(show_output: bool = False) -> str:
logger.info("Polygon key not defined")
status = KeyStatus.NOT_DEFINED
else:
check_date = date(date.today().year, date.today().month, 1).isoformat()
r = request(
"https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2020-06-01/2020-06-17"
f"?apiKey={current_user.credentials.API_POLYGON_KEY}"
f"https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/{check_date}"
f"/{check_date}?apiKey={current_user.credentials.API_POLYGON_KEY}"
)
if r.status_code in [403, 401]:
logger.warning("Polygon key defined, test failed")
Expand Down