I have a little peace of code which downloads a website for further data analysis.
It seems to work as it should (I get all the data I need), but in the log I get always the message:
2022-09-10 20:47:08.725 [WARN ] [HABApp.Rule ] - /usr/lib/python3.9/asyncio/sslproto.py:320: ResourceWarning:unclosed transport <asyncio.sslproto._SSLProtocolTransport object at 0x72f20928>
What can I do to stop this warning?
How can I react on it and close the transport?
async def ExtractLocalData(self):
'''
offizielle COVID-19 Daten aus Homepage extrahieren
'''
LOGGER = self.__class__.__name__ + ".ExtractLocalData "
# Website einlesen
URL = "https://www.touvia.de/mapapi.html?v2&cn=oal&no_clusterer&data_source=oal-covid-19"
HTTPStruct = None
try:
async with self.async_http.get(URL, timeout=9) as resp:
HTTPStruct = await resp.text()
except asyncio.TimeoutError:
self.log.error(LOGGER + "Timeout beim Holen der lokalen COVID-Daten")
# ResourceWarning:unclosed transport <asyncio.sslproto._SSLProtocolTransport object at 0x72fdd9b8>
if HTTPStruct is None:
return