Skip to content

Commit 0d9e027

Browse files
committed
Improve error message if db connection does not work
1 parent 0224eb7 commit 0d9e027

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

windpowerlib/data.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,17 +136,17 @@ def fetch_turbine_data_from_oedb(
136136
"""
137137
# url of OpenEnergy Platform that contains the oedb
138138
oep_url = "http://oep.iks.cs.ovgu.de/"
139+
url = oep_url + "/api/v0/schema/{}/tables/{}/rows/?".format(schema, table)
139140

140141
# load data
141-
result = requests.get(
142-
oep_url + "/api/v0/schema/{}/tables/{}/rows/?".format(schema, table),
143-
)
142+
result = requests.get(url)
144143
if not result.status_code == 200:
145144
raise ConnectionError(
146-
"Database connection not successful. "
147-
"Response: [{}]".format(result.status_code)
145+
"Database (oep) connection not successful. \nURL: {2}\n"
146+
"Response: [{0}] \n{1}".format(
147+
result.status_code, result.text, url
148+
)
148149
)
149-
# extract data to dataframe
150150
return pd.DataFrame(result.json())
151151

152152

0 commit comments

Comments
 (0)