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

Fix nasdaq top retail working without a key resulting in an error #5811

Merged
merged 6 commits into from
Nov 29, 2023

Conversation

the-praxs
Copy link
Contributor

Without the api key, equity.discovery.top_retail will try to fetch the data but will run into

openbb_core.app.model.abstract.error.OpenBBError: 'datatable'

This PR fixes this by raising an error if Nasdaq API key is not found.

@reviewpad reviewpad bot added the feat XS Extra small feature label Nov 28, 2023
@jmaslek
Copy link
Collaborator

jmaslek commented Nov 28, 2023

Should we also add the catch around the datatable not found in the response?

@montezdesousa
Copy link
Contributor

@the-praxs I get this. If the key is not being required by default that's would be a bug in the QueryExecutor, why should we require the key manually in the fetcher?

Screenshot 2023-11-28 at 18 41 29

@the-praxs
Copy link
Contributor Author

the-praxs commented Nov 28, 2023

@the-praxs I get this. If the key is not being required by default that's would be a bug in the QueryExecutor, why should we require the key manually in the fetcher?

Screenshot 2023-11-28 at 18 41 29

I discovered with James that if there's no API key (i.e. its "") in this particular model, you will receive the KeyError (wrapped as OpenBBError). However, there exists a vulnerability that it will accept any string in the API key for the link to work.

We can implement this hack for this case or if you have a long-term solution, please let me know!

@montezdesousa
Copy link
Contributor

montezdesousa commented Nov 28, 2023

@the-praxs I get this. If the key is not being required by default that's would be a bug in the QueryExecutor, why should we require the key manually in the fetcher?
Screenshot 2023-11-28 at 18 41 29

I discovered with James that if there's no API key (i.e. its "") in this particular model, you will receive the KeyError (wrapped as OpenBBError). However, there exists a vulnerability that it will accept any string in the API key for the link to work.

We can implement this hack for this case or if you have a long-term solution, please let me know!

If you check for None and "" line 52 it should work for every provider (you need to get_secret_value to check for "")

Screenshot 2023-11-28 at 18 55 19

@the-praxs
Copy link
Contributor Author

Should we also add the catch around the datatable not found in the response?

I think we should put a custom exception in try-catch for the dateable. Any ideas in mind?

@jmaslek jmaslek added this pull request to the merge queue Nov 29, 2023
Merged via the queue into develop with commit ce14ee6 Nov 29, 2023
21 checks passed
@piiq piiq deleted the hotfix/nasdaq-top-retail branch November 30, 2023 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat XS Extra small feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants