You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following source code used to execute in a few seconds, now it take takes arond 60-90 seconds. ,(I use this to fetch energy prices to calculate when to switch on devices in my house during cheaper energy hours).
Running home assistant core 2024.7.0, all updates done, latest version of pyscript (1.5.0)
When I run the python code locally it still only takes a few seconds. What can be the reason it has slowed down?
@pyscript_executor
def get_external_energy_data(ts_start, ts_end) -> list[HourPrice]:
"""Collects data from the easy_energy api from ts_start to ts_end"""
verify_ssl_cert = True
url='https://mijn.easyenergy.com/nl/api/tariff/getapxtariffs'
tsz_start = ts_start.isoformat()+'Z'
tsz_end = ts_end.isoformat()+'Z'
logging.info(f'Fetching data from {tsz_start} to {tsz_end}')
html=requests.get(url, params={'startTimestamp': tsz_start, 'endTimestamp': tsz_end} , verify=verify_ssl_cert)
logging.info(f' url {html.url}')
try:
data=json.loads(html.content)
except Exception as e:
from sys import stderr
print(html.status_code, html.content, file=stderr)
logging.info("error fetching data")
raise e
logging.info(f'Done fetching data from {tsz_start} to {tsz_end}')
example of the url that is called is the following:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The following source code used to execute in a few seconds, now it take takes arond 60-90 seconds. ,(I use this to fetch energy prices to calculate when to switch on devices in my house during cheaper energy hours).
Running home assistant core 2024.7.0, all updates done, latest version of pyscript (1.5.0)
When I run the python code locally it still only takes a few seconds. What can be the reason it has slowed down?
example of the url that is called is the following:
Beta Was this translation helpful? Give feedback.
All reactions