aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/tibber_prices.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/tibber_prices.py')
-rw-r--r--scripts/tibber_prices.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/tibber_prices.py b/scripts/tibber_prices.py
index 81b3afb..a2e9dda 100644
--- a/scripts/tibber_prices.py
+++ b/scripts/tibber_prices.py
@@ -34,11 +34,11 @@ try:
'Content-Type': 'application/json',
}
- body = {"query":"""{
- viewer {
- homes {
- currentSubscription{
- priceInfo{
+ body = {"query":"""{
+ viewer {
+ homes {
+ currentSubscription{
+ priceInfo{
today { total energy tax startsAt level currency }
tomorrow { total energy tax startsAt level currency }
}
@@ -46,13 +46,13 @@ try:
}
} }"""}
- response = requests.post(url, headers=hdr, json=body)
+ response = requests.post(url, headers=hdr, json=body, 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)