aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/entsoe.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/entsoe.py
parentmoving and renaming/breaking everything (diff)
downloadenergyscripts-7c403ecc8b6bd31f447eb91d73d95055489fbac4.tar.gz
fixing some lintingthings
Diffstat (limited to 'scripts/entsoe.py')
-rw-r--r--scripts/entsoe.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/entsoe.py b/scripts/entsoe.py
index 2597a98..85785dc 100644
--- a/scripts/entsoe.py
+++ b/scripts/entsoe.py
@@ -1,4 +1,5 @@
-#!/bin/python3
+#!/usr/bin/env python3
+''' Get energyprices from Entsoe '''
import os
import sys
@@ -56,13 +57,13 @@ for area in areas:
url = apiUrl + "&documentType=A44&in_Domain=" + area["code"] + "&out_Domain=" + area["code"] + "&periodStart=" + startTime + "0000&periodEnd=" + endTime + "0000"
print("Getting data for " + area["code"])
- response = requests.get(url)
+ response = requests.get(url, 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)