diff options
author | Dennis Eriksen <d@ennis.no> | 2022-10-04 08:24:52 +0200 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2022-10-04 08:24:52 +0200 |
commit | 3575d93dd0349b1b5d5025cd2531ae9e811f5b69 (patch) | |
tree | 77f51d30d54edfd1e7dba5dbdd376696fa882b90 | |
parent | adding grid tariff from elvia (diff) | |
download | energyscripts-3575d93dd0349b1b5d5025cd2531ae9e811f5b69.tar.gz |
adding prefix to environmental variables
-rwxr-xr-x | elvia2pgsql.py | 6 | ||||
-rwxr-xr-x | elvia_gridtariff2pgsql.py | 9 | ||||
-rwxr-xr-x | entsoe2pgsql.py | 6 | ||||
-rw-r--r-- | env.sample | 18 | ||||
-rwxr-xr-x | nb2pgsql.py | 4 | ||||
-rwxr-xr-x | tibber_consumption2pgsql.py | 6 | ||||
-rwxr-xr-x | tibber_prices2pgsql.py | 6 | ||||
-rwxr-xr-x | yr2pgsql.py | 8 |
8 files changed, 32 insertions, 31 deletions
diff --git a/elvia2pgsql.py b/elvia2pgsql.py index 665826d..4ed2430 100755 --- a/elvia2pgsql.py +++ b/elvia2pgsql.py @@ -11,11 +11,11 @@ from datetime import timedelta from tzlocal import get_localzone -apiKey = os.environ['elvia_token'] +apiKey = os.environ['el_elvia_token'] apiUrl = "https://elvia.azure-api.net/customer/metervalues/api/v1/metervalues" -pg_db = os.environ['pg_db'] -pg_host = os.environ['pg_host'] +pg_db = os.environ['el_pg_db'] +pg_host = os.environ['el_pg_host'] pg_table = "elvia" startTime = datetime.now(get_localzone()) - timedelta(days = 2) diff --git a/elvia_gridtariff2pgsql.py b/elvia_gridtariff2pgsql.py index b72f7de..7b97aee 100755 --- a/elvia_gridtariff2pgsql.py +++ b/elvia_gridtariff2pgsql.py @@ -10,13 +10,14 @@ from datetime import datetime from datetime import timedelta from tzlocal import get_localzone +# API documentation: https://elvia.portal.azure-api.net/docs/services/gridtariffapi/operations/post-digin-api-v-tariffquery-meteringpointsgridtariffs? -apiKey = os.environ['elvia_grid_api_key'] +apiKey = os.environ['el_elvia_grid_api_key'] apiUrl = "https://elvia.azure-api.net/grid-tariff/digin/api/1/tariffquery/meteringpointsgridtariffs" -meteringPointId = os.environ['meteringPointId'] +meteringPointId = os.environ['el_meteringPointId'] -pg_db = os.environ['pg_db'] -pg_host = os.environ['pg_host'] +pg_db = os.environ['el_pg_db'] +pg_host = os.environ['el_pg_host'] pg_table = "elvia_gridtariff" diff --git a/entsoe2pgsql.py b/entsoe2pgsql.py index 8474184..12befd9 100755 --- a/entsoe2pgsql.py +++ b/entsoe2pgsql.py @@ -24,13 +24,13 @@ from dateutil import tz # > respond to your request. # 1: https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html#_authentication_and_authorisation # 2: https://transparency.entsoe.eu/content/static_content/download?path=/Static%20content/API-Token-Management.pdf -apiKey = os.environ['entsoe_token'] +apiKey = os.environ['el_entsoe_token'] # https://transparency.entsoe.eu/content/static_content/Static%20content/web%20api/Guide.html apiUrl = "https://transparency.entsoe.eu/api?securityToken=" + apiKey -pg_db = os.environ['pg_db'] -pg_host = os.environ['pg_host'] +pg_db = os.environ['el_pg_db'] +pg_host = os.environ['el_pg_host'] pg_table = "entsoe" startTime = datetime.now(get_localzone()) - timedelta(days = 7) @@ -1,13 +1,13 @@ -export metringPointId=XXX -export elvia_token=XXX -export elvia_grid_api_key=XXX +export el_metringPointId=XXX +export el_elvia_token=XXX +export el_elvia_grid_api_key=XXX -export pg_db=XXX -export pg_host=XXX +export el_pg_db=XXX +export el_pg_host=XXX -export tibber_token=XXX +export el_tibber_token=XXX -export yr_lat=0.0 -export yr_lon=0.0 +export el_yr_lat=0.0 +export el_yr_lon=0.0 -export entsoe_token=XXX +export el_entsoe_token=XXX diff --git a/nb2pgsql.py b/nb2pgsql.py index 6a6ffe3..3993c41 100755 --- a/nb2pgsql.py +++ b/nb2pgsql.py @@ -15,8 +15,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['pg_db'] -pg_host = os.environ['pg_host'] +pg_db = os.environ['el_pg_db'] +pg_host = os.environ['el_pg_host'] pg_table = "nbex" startTime = datetime.now(get_localzone()) - timedelta(days = 10) diff --git a/tibber_consumption2pgsql.py b/tibber_consumption2pgsql.py index 6b61b9c..e710b8f 100755 --- a/tibber_consumption2pgsql.py +++ b/tibber_consumption2pgsql.py @@ -12,11 +12,11 @@ from tzlocal import get_localzone # variables -apiKey = os.environ['tibber_token'] +apiKey = os.environ['el_tibber_token'] apiUrl = "https://api.tibber.com/v1-beta/gql" -pg_db = os.environ['pg_db'] -pg_host = os.environ['pg_host'] +pg_db = os.environ['el_pg_db'] +pg_host = os.environ['el_pg_host'] pg_table = "tibber_consumption" startTime = datetime.now(get_localzone()) - timedelta(days = 1) diff --git a/tibber_prices2pgsql.py b/tibber_prices2pgsql.py index 5c0af5c..046072f 100755 --- a/tibber_prices2pgsql.py +++ b/tibber_prices2pgsql.py @@ -12,11 +12,11 @@ from tzlocal import get_localzone # variables -apiKey = os.environ['tibber_token'] +apiKey = os.environ['el_tibber_token'] apiUrl = "https://api.tibber.com/v1-beta/gql" -pg_db = os.environ['pg_db'] -pg_host = os.environ['pg_host'] +pg_db = os.environ['el_pg_db'] +pg_host = os.environ['el_pg_host'] pg_table = "tibber_prices" startTime = datetime.now(get_localzone()) - timedelta(days = 1) diff --git a/yr2pgsql.py b/yr2pgsql.py index f37f0be..28bb06e 100755 --- a/yr2pgsql.py +++ b/yr2pgsql.py @@ -6,11 +6,11 @@ import json import psycopg2 import requests -lat = str(os.environ['yr_lat']) -lon = str(os.environ['yr_lon']) +lat = str(os.environ['el_yr_lat']) +lon = str(os.environ['el_yr_lon']) -pg_db = os.environ['pg_db'] -pg_host = os.environ['pg_host'] +pg_db = os.environ['el_pg_db'] +pg_host = os.environ['el_pg_host'] pg_table = "yr" apiUrl = "https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=" + lat + "&lon=" + lon |