TikTokLive.proto package

Submodules

TikTokLive.proto.utilities module

TikTokLive.proto.utilities.deserialize_message(proto_name: str, obj: bytes) dict

Deserialize a protobuf message into a dictionary

Parameters:
  • proto_name – The name of the message

  • obj – The protobuf object to deserialize

Returns:

The dictionary containing the deserialized message

TikTokLive.proto.utilities.deserialize_websocket_message(binary_message: bytes) dict

Deserialize Websocket data. Websocket messages are in a container which contains additional data. A message type ‘msg’ represents a normal WebcastResponse

Parameters:

binary_message – The binary to decode

Returns:

The resultant decoded python dictionary

TikTokLive.proto.utilities.from_dict_plus(data_class: Type[T], data: Dict[str, Any], config: Optional[Config] = None) Any

Load a schema from a dict and set the _as_dict attribute automatically

Parameters:
  • data_class – Data class schema

  • data – Data to fit into data class

  • config – Config for dacite

Returns:

A dataclass containing type T

TikTokLive.proto.utilities.serialize_message(proto_name: str, data: dict) bytes

Serialize a message from a dict to a protobuf bytearray

Parameters:
  • proto_name – The name of the protobuf message to serialize the message to

  • data – The data to use in serialization

Returns:

Bytearray containing the serialized protobuf message

Module contents