ts3.response

This module contains the classes to parse a TeamSpeak 3 Server Query response and to structure the data.

exception ts3.response.TS3ParserError(resp, exc=None)[source]

Bases: ts3.common.TS3Error, ValueError

Raised, if the data could not be parsed.

resp = None

The TS3Response object, that has thrown the exception.

exc = None

The original exception, if the parsing failed due to an exception like UnicodeDecodeError.

class ts3.response.TS3Response(data)[source]

Bases: object

Parses ONE response and stores it’s data. If you init an instance with the data of more than one response, parsing will fail.

Note, that this class is lazy. This means, that the response is only parsed, if you request an attribute, that requires a parsed version of the data.

For convenience, this class supports container emualtion, so these calls are equal:

>>> ts3resp.parsed[0]["client_nickname"] == ts3resp[0]["client_nickname"]
True
Parameters:data (bytes) – The byte string received from the server.
data
Getter:The list of lines from the original received response.
Type:list of bytes
data_bytestr
Getter:The raw response as bytestring.
Type:bytes
parsed
Getter:The parsed response as a list of dictionaries.
Type:list of dictionaries [str->str]
Raises:TS3ParserError – If the response could not be parsed.
class ts3.response.TS3QueryResponse(data)[source]

Bases: ts3.response.TS3Response

The same as TS3Response, but the error attribute is public.

error
Getter:A dictionary, that contains the error id and message.
Type:dict
Raises:TS3ParserError – If the response could not be parsed.
class ts3.response.TS3Event(data)[source]

Bases: ts3.response.TS3Response

The same as TS3Response, but the event attribute is public.

event
Getter:A dictionary with the information about the event.
Type:dict
Raises:TS3ParserError – If the response could not be parsed.