OpenBB icon indicating copy to clipboard operation
OpenBB copied to clipboard

[Bug] OpenBB SDK compains about not having API_FRED_KEY even though it exists

Open jasonstrimpel opened this issue 2 years ago • 3 comments

Describe the bug I'm attempting to run the openbb.economy.fred method in a Jupyter Notebook using the OpenBB SDK.

When I do, I receive a warning: API_FRED_KEY not defined. Set API Keys in ~/.openbb_terminal/.env or under keys menu.

I set my FRED API keys in ~/.openbb_terminal/.env like this:

API_FRED_KEY='my_fred_api_key'

When I re-run the openbb.economy.fred method in a Jupyter Notebook using the OpenBB SDK, I get the same warning.

To Reproduce See above

Screenshots Screen Shot 2023-01-24 at 05 39 02

Screen Shot 2023-01-24 at 05 39 24

Desktop (please complete the following information):

  • OS: Mac
  • Python version: 3.19.13

Additional context

  1. After adding the API key to the .env file, I shut down the terminal window and Jupyter Notebook instance before trying again.
  2. I tried adding the API both with and without quotes.
  3. I tried running the same code from a Python interactive session.

jasonstrimpel avatar Jan 24 '23 12:01 jasonstrimpel

Will investigate. An alternative with the sdk would be:

openbb.keys.fred(
    key = 'replace_me',
    persist = True,
)

Which will replace in the correct env file

jmaslek avatar Jan 24 '23 14:01 jmaslek

This worked.

jasonstrimpel avatar Jan 25 '23 11:01 jasonstrimpel

Hey @jasonstrimpel

Anychance that the original issue has been resolved with the update?

jmaslek avatar Feb 02 '23 15:02 jmaslek

Looks like it's fixed now:

image

Disclaimer: this might not behave exactly this way after #4015 is merged.

hjoaquim avatar Feb 07 '23 10:02 hjoaquim