get_source#

async AsyncAPI.get_source(source_id, realtime_start=None, realtime_end=None)#

Get a FRED source

Retrieves information about a source from the FRED API.

Parameters:
  • source_id (int) – The ID for the source.

  • realtime_start (str | datetime, optional) – The start of the real-time period. String format: YYYY-MM-DD. Defaults to None.

  • realtime_end (str | datetime, optional) – The end of the real-time period. String format: YYYY-MM-DD. Defaults to None.

Returns:

If multiple sources are returned.

Return type:

List[Source]

Raises:

ValueError – If the request to the FRED API fails or returns an error.

Example

>>> import fedfred as fd
>>> import asyncio
>>> async def main():
>>>     fred = fd.FredAPI('your_api_key').Async
>>>     source = await fred.get_source(1)
>>>     print(source.name)
>>> asyncio.run(main())
'Board of Governors of the Federal Reserve System'
FRED API Documentation:

https://fred.stlouisfed.org/docs/api/fred/source.html