Skip to content

Commit

Permalink
Expose connection url
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed Oct 12, 2023
1 parent 32c76f7 commit 9ecb07b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions speedport/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__(
self._host: str = host
self._password: str = password
self._https: bool = https
self._url = f"https://{host}" if https else f"http://{host}"
self._session: aiohttp.ClientSession | None = session

async def __aenter__(self):
Expand All @@ -65,6 +66,10 @@ def api(self) -> Connection:
def password(self) -> str:
return self._password

@property
def url(self) -> str:
return self._url

async def get_status(self):
return await self.api.get("data/Status.json")

Expand Down
5 changes: 2 additions & 3 deletions speedport/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ def simplify_response(
class Connection:
def __init__(
self,
host: str = "speedport.ip",
https: bool = False,
host_url: str = "",
session: aiohttp.ClientSession | None = None,
):
self._login_key = ""
self._cookies = {}
self._url = f"https://{host}" if https else f"http://{host}"
self._url = host_url
self._session: aiohttp.ClientSession | None = session

async def __aenter__(self):
Expand Down

0 comments on commit 9ecb07b

Please sign in to comment.