Skip to content

Commit 906ea35

Browse files
authored
Merge pull request #2 from andrewkreuzer/master
Add get_logs function to client to return system logs
2 parents f210ad9 + 67fe20c commit 906ea35

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

sagemcom_api/client.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,25 @@ async def get_port_mappings(self) -> List[PortMapping]:
399399

400400
return port_mappings
401401

402+
async def get_logs(self) -> List[str]:
403+
"""
404+
Retrieve system logs.
405+
"""
406+
407+
actions = {
408+
"id": 0,
409+
"method": "getVendorLogDownloadURI",
410+
"xpath": urllib.parse.quote("Device/DeviceInfo/VendorLogFiles/VendorLogFile[@uid='1']"),
411+
}
412+
413+
response = await self.__api_request_async([actions], False)
414+
log_path = response["reply"]["actions"][0]["callbacks"][0]["parameters"]["uri"]
415+
416+
log_uri = f"{self.protocol}://{self.host}{log_path}"
417+
response = await self.session.get(log_uri, timeout=10)
418+
419+
return await response.text()
420+
402421
async def reboot(self):
403422
"""Reboot Sagemcom F@st device."""
404423
action = {

0 commit comments

Comments
 (0)