The function update_database
in main.py
updates the consumer price index database when new data is available from Genesis. It uses the database's API at https://europe-west3-rbb-data-inflation.cloudfunctions.net/consumer-price-index-api (GitHub)
Note
The function uses secret environment variables. Add
API_SECRET
(secret to post to the consumer price index API) andGENESIS_PASSWORD
(password for Genesis API) to.env.local
that is not checked into version control.
Load environment variables from .env
and .env.local
:
export $(cat .env .env.local | xargs)
Install dependencies from requirement.txt
and run the function:
python dev.py
Set cloud project
gcloud config set project rbb-data-inflation
and run:
gcloud functions deploy update-consumer-price-index-database \
--region=europe-west3 \
--runtime=python310 \
--entry-point=update_database \
--trigger-topic=database-update