Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fred Economic Data API
#1
Hello,

I was hoping to get a hand in setting up the Fred Economic Data API. I'm relatively new at using Python so I will need a basic understanding if anyone has some time to help me out here.

I currently have an API key assigned to me but not sure how to retrieve the data. Would I have to download packages from Fred?

I'm throwing darts here and tried the following, but errors were returns. (attached)

pip install full-fred
!pip install fredapi

Thanks,

Mike

Attached Files

Thumbnail(s)
       
Reply
#2
Are you behind a proxy or something? Also, please, don't post images of code/data/errors. Post as text using BBCode
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Feb-26-2024, 06:29 PM)buran Wrote: Are you behind a proxy or something? Also, please, don't post images of code/data/errors. Post as text using BBCode

Thanks for the response and heads up about BBcode. I am on a VPN and within my proxy settings the option to "use setup script" is "on" with a company script address included.

Just turned the VPN off and got this error (I hope I shared it correctly)
Error:
Could not fetch URL https://pypi.org/simple/full-fred/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/full-fred/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))) - skipping Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))) - skipping Note: you may need to restart the kernel to use updated packages. WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))': /simple/full-fred/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))': /simple/full-fred/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))': /simple/full-fred/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))': /simple/full-fred/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1129)'))': /simple/full-fred/ ERROR: Could not find a version that satisfies the requirement full-fred (from versions: none) ERROR: No matching distribution found for full-fred WARNING: There was an error checking the latest version of pip.
Reply
#4
I’d recommend starting with the fredapi package — that’s the one most people use. Once you’ve installed it (pip install fredapi), you can do something like:

from fredapi import Fred
fred = Fred(api_key="your_api_key_here")
data = fred.get_series("GDP")
print(data.head())

That should let you pull data without too much trouble. Later on, if you’re building a workflow that needs consistent results, you could add a programmable verification engine called Verify API. It can help catch formatting issues or unexpected responses before they cause problems in your scripts.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020