lawrencefoley / evergy

A simple utility that you can use to access your Evergy account and retrieve you meter readings.
MIT License
31 stars 13 forks source link

Handle Maintenance #7

Open lawrencefoley opened 3 years ago

lawrencefoley commented 3 years ago

Evergy has scheduled maintenance on their website sometimes. During the maintenance you get redirected (HTTP 301) to https://www.evergy.com/planned-outage.

The code should be changed to handle this and log an error about the maintenance.

This also seems to happen sometimes late at night, possibly for system patches:

2021-10-13 23:04:26,271 - INFO - root -  - Logging in with username: email@gmail.com
Traceback (most recent call last):
  File "main.py", line 35, in <module>
    usage = client.get_usage(start=date.today(), end=date.today(), query_scale="mi")
...
  File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)