Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions envoy_reader/envoy_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@ async def _async_fetch_with_retry(self, url, **kwargs):
resp = await client.get(
url, headers=self._authorization_header, timeout=30, **kwargs
)
if resp.status_code == 401 and attempt < 2:
_LOGGER.debug(
"Received 401 from Envoy; refreshing token, attempt %s of 2",
attempt+1,
)
await self._getEnphaseToken()
continue
_LOGGER.debug("Fetched from %s: %s: %s", url, resp, resp.text)
return resp
except httpx.TransportError:
Expand Down