Rest API Reference

class kxspy.rest.RestApi(kxs_network_rest_url: str = 'https://network.kxs.rip', adminKey: str = None, session: ClientSession = None)[source]

Bases: object

The 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

dict or str

The response from the request.

async online_count() dict[source]

This function makes a request to the kxs network REST API.

Returns

dict

The 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

dict

The response from the request.

async getLatestVersion() str[source]

This function makes a request to the kxs network REST API.

Returns

str

The 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

str

The 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

dict

The 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

dict

The 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

dict

The 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

dict

The response from the request.

async get_rest_latency() float[source]

|coro|

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. -1 if an error occurred during the request (e.g. node is unreachable), otherwise, a positive number.