aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/elvia.py
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2023-02-01 20:59:42 +0100
committerDennis Eriksen <d@ennis.no>2023-02-01 20:59:42 +0100
commit7c403ecc8b6bd31f447eb91d73d95055489fbac4 (patch)
treef70a96871178c0d78be505cc71f090e4e91857ea /scripts/elvia.py
parentmoving and renaming/breaking everything (diff)
downloadenergyscripts-7c403ecc8b6bd31f447eb91d73d95055489fbac4.tar.gz
fixing some lintingthings
Diffstat (limited to 'scripts/elvia.py')
-rw-r--r--scripts/elvia.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/elvia.py b/scripts/elvia.py
index be5eaae..6e4bc9f 100644
--- a/scripts/elvia.py
+++ b/scripts/elvia.py
@@ -1,13 +1,12 @@
#!/usr/bin/env python3
-''' elvia2pgsql '''
+''' Get energy consumption from Elvia '''
import os
import sys
-import requests
-
from datetime import datetime
from datetime import timedelta
from tzlocal import get_localzone
+import requests
from common import dbi
@@ -31,13 +30,13 @@ try:
'Authorization': "Bearer " + apiKey,
}
- response = requests.get(url, headers=hdr)
+ response = requests.get(url, headers=hdr, timeout=10)
if response.status_code != 200:
print(response.status_code)
print("Oh shit")
response.raise_for_status()
-except Exception as e:
+except requests.exceptions.RequestException as e:
print("oh lol")
sys.exit(e)