Skip to content

Commit

Permalink
refactor(asynceapi): Use http head request to check_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
dlobato committed Oct 4, 2024
1 parent fc644a1 commit 049202b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 65 deletions.
63 changes: 0 additions & 63 deletions asynceapi/aio_portcheck.py

This file was deleted.

7 changes: 5 additions & 2 deletions asynceapi/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# -----------------------------------------------------------------------------
# Private Imports
# -----------------------------------------------------------------------------
from .aio_portcheck import port_check_url
from .config_session import SessionConfig
from .errors import EapiCommandError

Expand Down Expand Up @@ -122,7 +121,11 @@ async def check_connection(self) -> bool:
bool
True when the device eAPI is accessible, False otherwise.
"""
return await port_check_url(self.base_url)
try:
await self.head(self.base_url, timeout=5)
except httpx.RequestError:
return False
return True

async def cli( # noqa: PLR0913
self,
Expand Down

0 comments on commit 049202b

Please sign in to comment.