jesserizzo / envoy_reader

MIT License
37 stars 26 forks source link

retry 401s from the envoy #90

Open djk121 opened 2 years ago

djk121 commented 2 years ago

Because there can be enough time between when _is_enphase_token_expired() is called and when the subsequent http request to the envoy happens, the token freshness check can pass but the envoy will still see an expired token. This results in a 401 from the envoy, which raises an exception.

This change looks for these 401s and attempts to refresh the token twice before giving up.

Pull request recommendations:

Thanks for contributing!