A Python wrapper for the Federal Reserve Economic Data (FRED) API. It simplifies fetching economic data series, historical data, categories, and releases from FRED and adds security through PGP signature verification.
- Easy-to-use Python interface for FRED API
- Support for fetching series data, historical data, categories, and releases
- Built-in PGP token verification for enhanced security
- Customizable error handling
To install the FRED API Wrapper, run the following command:
pip install fred-api-wrapper gnupgHere's a quick example of how to use the FRED API Wrapper with PGP signature verification:
from fred_api_wrapper import FredPyAPI
# Initialize the API
fred_api = FredPyAPI()
# Import the public key
fred_api.import_public_key('path/to/public_key.asc')
# Verify and set the token
fred_api.verify_and_set_token('path/to/signed_token.asc')
# Now you can use the API as before
gdp_data = fred_api.get_series_data("GDP")
print(gdp_data)This wrapper uses PGP for API key verification. To use this feature:
-
Generate a PGP key pair if you don't have one:
gpg --full-generate-key -
Export your public key:
gpg --armor --export your_email@example.com > public_key.asc -
Sign your FRED API key:
echo "your_fred_api_key" | gpg --clearsign > signed_token.asc -
Use these files with the
import_public_keyandverify_and_set_tokenmethods, as shown in the usage example.
[The API reference section remains the same]
Contributions to the FRED API Wrapper are welcome! For guidelines on how to contribute to this project, please refer to CONTRIBUTING.md.
This project is licensed under the MIT License. Please take a look at the LICENSE file for details.
- Federal Reserve Bank of St. Louis for providing the FRED API
- All contributors to this project
For any questions or concerns, please open an issue on the GitHub repository.