Skip to content

Commit

Permalink
Aggiunta debug richiesta web in caso di timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualdj committed Dec 17, 2023
1 parent 905e270 commit e519109
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions custom_components/pun_sensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ async def _async_update_data(self):
DOWNLOAD_URL = 'https://www.mercatoelettrico.org/It/download/DownloadDati.aspx?val=MGP_Prezzi'

# Apre la pagina per generare i cookie e i campi nascosti
_LOGGER.debug('Connessione a URL login.')
async with self.session.get(LOGIN_URL) as response:
soup = BeautifulSoup(await response.read(), features='html.parser')

Expand All @@ -175,6 +176,7 @@ async def _async_update_data(self):
}

# Effettua il login (che se corretto porta alla pagina di download XML grazie al 'ReturnUrl')
_LOGGER.debug('Invio credenziali a URL login.')
async with self.session.post(LOGIN_URL, data=login_payload) as response:
soup = BeautifulSoup(await response.read(), features='html.parser')

Expand All @@ -188,6 +190,7 @@ async def _async_update_data(self):
}

# Effettua il download dello ZIP con i file XML
_LOGGER.debug('Inizio download file ZIP con XML.')
async with self.session.post(DOWNLOAD_URL, data=data_request_payload) as response:
# Scompatta lo ZIP in memoria
try:
Expand Down

0 comments on commit e519109

Please sign in to comment.