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

[BugFix] - Case insensitive credentials #6400

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion assets/extensions/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
},
{
"packageName": "openbb-polygon",
"reprName": "Polygon",
"reprName": "Polygon.io",
"description": "The Polygon.io Stocks API provides REST endpoints that let you query\nthe latest market data from all US stock exchanges. You can also find data on\ncompany financials, stock market holidays, corporate actions, and more.",
"credentials": [
"polygon_api_key"
Expand Down
4 changes: 2 additions & 2 deletions openbb_platform/core/openbb_core/app/model/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def prepare(
formatted[c] = (
Optional[OBBSecretStr],
Field(
default=None, description=origin
default=None, description=origin, alias=c.upper()
), # register the credential origin (obbject, providers)
)

Expand Down Expand Up @@ -88,7 +88,7 @@ def load(self) -> BaseModel:
self.from_obbject()
return create_model( # type: ignore
"Credentials",
__config__=ConfigDict(validate_assignment=True),
__config__=ConfigDict(validate_assignment=True, populate_by_name=True),
**self.prepare(self.credentials),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def platform2hub(self, credentials: Credentials) -> HubUserSettings:
settings = self._hub_user_settings or HubUserSettings()
for v4_k, v in sorted(credentials.items()):
v3_k = self.V4TOV3.get(v4_k, None)
# If v3 key was there, we keep it
# If v3 key was in the hub already, we keep it
k = v3_k if v3_k in settings.features_keys else v4_k
settings.features_keys[k] = v
return settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"MarketIndices": PolygonIndexHistoricalFetcher,
"MarketSnapshots": PolygonMarketSnapshotsFetcher,
},
repr_name="Polygon",
repr_name="Polygon.io",
v3_credentials=["API_POLYGON_KEY"],
instructions='Go to: https://polygon.io\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207825623-fcd7f0a3-131a-4294-808c-754c13e38e2a.png)\n\nClick on, "Get your Free API Key".\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207825952-ca5540ec-6ed2-4cef-a0ed-bb50b813932c.png)\n\nAfter signing up, the API Key is found at the bottom of the account dashboard page.\n\n![Polygon](https://user-images.githubusercontent.com/46355364/207826258-b1f318fa-fd9c-41d9-bf5c-fe16722e6601.png)', # noqa: E501 pylint: disable=line-too-long
logo_url="https://polygon.io/_next/image?url=%2Flogo.svg&w=640&q=75",
Expand Down
Loading