From 4ad7f2e5111ca9e27dcbe5781c87f249bc7377ad Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Thu, 9 Nov 2023 13:57:26 +0100 Subject: added new function to get env which handles missing env better... --- scripts/nb.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts/nb.py') diff --git a/scripts/nb.py b/scripts/nb.py index d00b0d2..6afb74e 100644 --- a/scripts/nb.py +++ b/scripts/nb.py @@ -2,7 +2,6 @@ """ Get exchange rates from nb """ import csv -import os import sys import tempfile from datetime import datetime, timedelta @@ -14,8 +13,8 @@ from tzlocal import get_localzone # I'm not sure I understand Norges Banks json-model. It seems a lot easier to just get the CSV, and convert it to JSON. apiUrl = "https://data.norges-bank.no/api/data/EXR/B.EUR.NOK.SP?format=csv&locale=en" -pg_db = os.environ["el_pg_db"] -pg_host = os.environ["el_pg_host"] +pg_db = common.env("el_pg_db") +pg_host = common.env("el_pg_host") pg_table = "nbex" startTime = datetime.now(get_localzone()) - timedelta(days=10) -- cgit v1.2.3