summaryrefslogtreecommitdiffstats
path: root/metrics.py
diff options
context:
space:
mode:
Diffstat (limited to 'metrics.py')
-rw-r--r--metrics.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/metrics.py b/metrics.py
new file mode 100644
index 0000000..af07f1d
--- /dev/null
+++ b/metrics.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+from api import TeamSpeakApi
+
+
+class TeamSpeakMetrics(TeamSpeakApi):
+ """
+ TeamSpeak metrics harvester
+ """
+
+ def __init__(self, url: str, apikey: str = None):
+ # init teamspeak api
+ super().__init__(apikey=apikey, url=url)
+
+ # variables
+ self.url = url
+
+ def serverinfo(self, id: int = 1) -> dict:
+ tmp = self.cmd(f"{id}/serverinfo")
+
+ if tmp["status"]["code"] != 0:
+ return {}
+ else:
+ return tmp["body"][0]