add server options

This commit is contained in:
2024-09-21 19:49:34 +02:00
parent d3a188106c
commit 5f34e4b27b

View File

@@ -16,7 +16,7 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
class SatiAPI:
"""A API wrapper for Satisfactory dedicated server"""
__AUTHOR__ = 'anima'
__VERSION__ = '0.2.1'
__VERSION__ = '0.3.2'
def __init__(self, host: str = None, port: int = 7777, token: str = None, conffile: str = 'conf.yml', logfile: str = 'SatiAPI.log', loglevel: int = 20) -> None:
"""create a wrapper for satisfactory dedicated server
@@ -181,6 +181,7 @@ class SatiAPI:
def get_token(self, password: str = None, privilegeLevel: str = 'Administrator') -> bool:
"""get token from satisfacory dedicated server, password is needed!
Attempts to log in to the Dedicated Server as a player using either Admin Password or Client Protection Password. This function requires no Authentication.
:param password: password of admin level
:type password: string
@@ -219,7 +220,7 @@ class SatiAPI:
return True
def get_status(self) -> dict:
"""get basis status of satisfacory server
"""Retrieves the current state of the Dedicated Server. Does not require any input parameters.
:return: full return from server
:rtpye: dict
@@ -239,7 +240,18 @@ class SatiAPI:
return self.__query('HealthCheck', data)
def get_server_options(self) -> dict:
"""Retrieves currently applied server options and server options that are still pending application (because of needing session or server restart) Does not require input parameters.
:return: full return from server
:rtpye: dict
"""
return self.__query('GetServerOptions')
## todo
#PasswordlessLogin
if __name__ == "__main__":
sati = SatiAPI(loglevel=10)
# print('Verbundene Spieler: ', sati.get_status()['serverGameState']['numConnectedPlayers'])
print(sati.health_check())
print(sati.get_server_options())