Skip to content

Commit

Permalink
Try fix for unclosed connection during discover
Browse files Browse the repository at this point in the history
  • Loading branch information
ankohanse committed Dec 23, 2024
1 parent 28dd931 commit 46aad5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "aioxcom"
version = "1.6.1"
version = "1.6.2"
authors = [
{ name="Anko Hanse", email="[email protected]" },
]
Expand Down
11 changes: 5 additions & 6 deletions src/aioxcom/xcom_discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,11 @@ async def discoverMoxaWebConfig(hint: str = None) -> str:
# Define helper function to check for Moxa Web Config page
async def check_url(session, url:str) -> str|None:
_LOGGER.debug(f"trying {url}")
rsp = await session.get(url)

if rsp and rsp.ok and rsp.headers.get("Server", "").startswith("Moxa"):
return url
else:
return None
async with session.get(url) as rsp:
if rsp and rsp.ok and rsp.headers.get("Server", "").startswith("Moxa"):
return url
else:
return None

# Parallel check for Moxa Web Config page on all found device url's
# No need to SSL verify plain HTTP GET calls, this also keeps Home Assistant happy
Expand Down

0 comments on commit 46aad5d

Please sign in to comment.