Skip to content

Commit

Permalink
Merge pull request #141 from francescortiz/master
Browse files Browse the repository at this point in the history
Don't send debug messages to stdout for CLI compatibility.
  • Loading branch information
fboerman authored Nov 20, 2021
2 parents 5fc7d12 + fb1fb46 commit 075b0a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions entsoe/decorators.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from socket import gaierror
from time import sleep
import requests
Expand All @@ -22,7 +23,7 @@ def retry_wrapper(*args, **kwargs):
except (requests.ConnectionError, gaierror) as e:
error = e
print("Connection Error, retrying in {} seconds".format(
self.retry_delay))
self.retry_delay), file=sys.stderr)
sleep(self.retry_delay)
continue
else:
Expand Down Expand Up @@ -90,7 +91,7 @@ def day_wrapper(*args, start, end, **kwargs):
try:
frame = func(*args, start=_start, end=_end, **kwargs)
except NoMatchingDataError:
print(f"NoMatchingDataError: between {_start} and {_end}")
print(f"NoMatchingDataError: between {_start} and {_end}", file=sys.stderr)
frame = None
frames.append(frame)

Expand Down
3 changes: 2 additions & 1 deletion entsoe/parsers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
import zipfile
from io import BytesIO
from typing import Union
Expand Down Expand Up @@ -357,7 +358,7 @@ def _parse_contracted_reserve_series(soup, tz, label):
df.sort_index(inplace=True)
index = _parse_datetimeindex(soup, tz)
if len(index) > len(df.index):
print("Shortening index")
print("Shortening index", file=sys.stderr)
df.index = index[:len(df.index)]
else:
df.index = index
Expand Down
4 changes: 2 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ def test_basic_queries(self):
def test_basic_series(self):
queries = [
self.client.query_day_ahead_prices,
self.client.query_load,
self.client.query_load_forecast,
self.client.query_generation_forecast,
self.client.query_net_position_dayahead
]
Expand All @@ -110,6 +108,8 @@ def query_crossborder_flows(self):

def test_basic_dataframes(self):
queries = [
self.client.query_load,
self.client.query_load_forecast,
self.client.query_wind_and_solar_forecast,
self.client.query_generation,
self.client.query_installed_generation_capacity,
Expand Down

0 comments on commit 075b0a6

Please sign in to comment.