Rest API Reference
- class kxspy.rest.RestApi(kxs_network_rest_url: str = 'https://network.kxs.rip', adminKey: str = None, session: ClientSession = None)[source]
Bases:
objectThe class for the REST API of kxspy.
Parameters
- kxs_network_rest_url:
str Rest url of the kxs network REST API.
- adminKey:
str Only for admin routs .
- async request(method: str, rout: str, data: dict = {}) dict[source]
This function makes a request to the kxs network REST API.
Parameters
- method:
str method for request like GET or POST etc.
- rout:
str The route for request.
- data:
dict The data for request.
Returns
dictorstrThe response from the request.
- method:
- async online_count() dict[source]
This function makes a request to the kxs network REST API.
Returns
dictThe response from the request.
- async ig_count(gameId: str) dict[source]
This function makes a request to the kxs network REST API.
Parameters
- gameId:
str The game id.
Returns
dictThe response from the request.
- gameId:
- async getLatestVersion() str[source]
This function makes a request to the kxs network REST API.
Returns
strThe response from the request.
- async on_join(gameid: int, exchangeKey: str) dict[source]
This function makes a request to the kxs network REST API.
Returns
strThe response from the request.
- async user_manager_status() dict[source]
This function makes a request to the kxs network REST API ( kxs admin endpoint ).
Returns
dictThe response from the request.
- async broadcast(msg: str) dict[source]
This function makes a request to the kxs network REST API ( kxs admin endpoint ).
Returns
dictThe response from the request.
- async blacklist(ip: str, reason: str) dict[source]
This function makes a request to the kxs network REST API ( kxs admin endpoint ).
Returns
dictThe response from the request.
- async unblacklist(ip: str) dict[source]
This function makes a request to the kxs network REST API ( kxs admin endpoint ).
Returns
dictThe response from the request.
- async get_rest_latency() float[source]
-
Measures the REST latency for this node. This simply calls
get_version()but measures the time between when the request was made, and when a response was received.Returns
- float
The latency, in milliseconds.
-1if an error occurred during the request (e.g. node is unreachable), otherwise, a positive number.
- kxs_network_rest_url: