add server options
This commit is contained in:
18
SatiAPI.py
18
SatiAPI.py
@@ -16,7 +16,7 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|||||||
class SatiAPI:
|
class SatiAPI:
|
||||||
"""A API wrapper for Satisfactory dedicated server"""
|
"""A API wrapper for Satisfactory dedicated server"""
|
||||||
__AUTHOR__ = 'anima'
|
__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:
|
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
|
"""create a wrapper for satisfactory dedicated server
|
||||||
@@ -181,6 +181,7 @@ class SatiAPI:
|
|||||||
|
|
||||||
def get_token(self, password: str = None, privilegeLevel: str = 'Administrator') -> bool:
|
def get_token(self, password: str = None, privilegeLevel: str = 'Administrator') -> bool:
|
||||||
"""get token from satisfacory dedicated server, password is needed!
|
"""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
|
:param password: password of admin level
|
||||||
:type password: string
|
:type password: string
|
||||||
@@ -219,7 +220,7 @@ class SatiAPI:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def get_status(self) -> dict:
|
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
|
:return: full return from server
|
||||||
:rtpye: dict
|
:rtpye: dict
|
||||||
@@ -239,7 +240,18 @@ class SatiAPI:
|
|||||||
|
|
||||||
return self.__query('HealthCheck', data)
|
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__":
|
if __name__ == "__main__":
|
||||||
sati = SatiAPI(loglevel=10)
|
sati = SatiAPI(loglevel=10)
|
||||||
# print('Verbundene Spieler: ', sati.get_status()['serverGameState']['numConnectedPlayers'])
|
# print('Verbundene Spieler: ', sati.get_status()['serverGameState']['numConnectedPlayers'])
|
||||||
print(sati.health_check())
|
print(sati.get_server_options())
|
||||||
Reference in New Issue
Block a user