Skip to content

Commit 67fe20c

Browse files
committed
Add get_logs function to client to return system logs
1 parent 9441fdd commit 67fe20c

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
@@ -396,6 +396,25 @@ async def get_port_mappings(self) -> List[PortMapping]:
396396

397397
return port_mappings
398398

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

0 commit comments

Comments
 (0)