File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1+ # envrc
2+ .envrc
3+
14# JetBrains
25.idea /
36
Original file line number Diff line number Diff line change 1- # fred_py_api
2- FRED API Python Wrapper
1+ # Fred Python API
2+ A fully-featured FRED Python Wrapper.
33
4- ### FRED Reference
5- - [ Fred API Documentation] ( https://fred.stlouisfed.org/docs/api/fred/ )
4+ ### FRED References:
5+ - [ API Documentation] ( https://fred.stlouisfed.org/docs/api/fred/ )
Original file line number Diff line number Diff line change 33Fred API Client.
44"""
55from http import HTTPStatus
6+ from os import environ
67
78import requests
89
@@ -14,7 +15,10 @@ class FredClient(object):
1415
1516 def __init__ (self , api_key : str = None , base_client = None ):
1617 """Init client."""
17- assert api_key or base_client , "Fred API Client or API Key required to use FredAPISeries"
18+ if not base_client :
19+ base_client = environ .get ("FRED_API_KEY" , None )
20+
21+ assert api_key or base_client , "Fred API Client or API Key required to use FredAPI"
1822
1923 if base_client and isinstance (base_client , FredClient ):
2024 self ._api_key = base_client .get_api_key ()
You can’t perform that action at this time.
0 commit comments