diff options
author | Dennis Eriksen <d@ennis.no> | 2023-02-04 14:18:18 +0100 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2023-02-04 14:18:18 +0100 |
commit | eb5e90aded9a7259ddecc94d9244393fa5abd2e6 (patch) | |
tree | 8e166a3bec6435c1490cff04cd704ae847b47eba /scripts/elvia_gridtariff.py | |
parent | queue sleep as variable (diff) | |
download | energyscripts-eb5e90aded9a7259ddecc94d9244393fa5abd2e6.tar.gz |
moving some variables around
Diffstat (limited to 'scripts/elvia_gridtariff.py')
-rw-r--r-- | scripts/elvia_gridtariff.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/scripts/elvia_gridtariff.py b/scripts/elvia_gridtariff.py index 28810b2..60692b4 100644 --- a/scripts/elvia_gridtariff.py +++ b/scripts/elvia_gridtariff.py @@ -8,7 +8,7 @@ from datetime import timedelta from tzlocal import get_localzone import requests -from common import dbi +import common # API documentation: https://elvia.portal.azure-api.net/docs/services/gridtariffapi/operations/post-digin-api-v-tariffquery-meteringpointsgridtariffs? @@ -16,11 +16,6 @@ apiKey = os.environ['el_elvia_grid_api_key'] apiUrl = "https://elvia.azure-api.net/grid-tariff/digin/api/1/tariffquery/meteringpointsgridtariffs" meteringPointId = os.environ['el_meteringPointId'] -pg_db = os.environ['el_pg_db'] -pg_host = os.environ['el_pg_host'] -pg_table = "elvia_gridtariff" - - startTime = datetime.now(get_localzone()) - timedelta(days = 2) startTime = startTime.strftime('%Y-%m-%d') @@ -66,4 +61,4 @@ values = [] for item in data['gridTariffCollections'][0]['gridTariff']['tariffPrice']['hours']: values.append((meteringPointId, item['startTime'], item['expiredAt'], item['shortName'], item['isPublicHoliday'], item['energyPrice']['total'], item['energyPrice']['totalExVat'])) -dbi("INSERT INTO " + pg_table + " VALUES(%s,%s,%s,%s,%s,%s,%s) ON CONFLICT (meteringPointId,startTime,endTime) DO NOTHING", values, verbose=True) +common.dbi(common.sql[common.name], values, verbose=True) |