pytdbot.tdjson.tdjson

class pytdbot.tdjson.tdjson.TdJson(lib_path=None, verbosity=2)[source]

Bases: object

Parameters:
  • lib_path (str)

  • verbosity (int)

__init__(lib_path=None, verbosity=2)[source]

TdJson client

Parameters:
  • lib_path (str, optional) – Path to shared library; if None then [tdjson](https://github.com/AYMENJD/tdjson) binding will be used. Default is None

  • verbosity (int, optional) – TDLib verbosity level. Default is 2

Raises:

ValueError – If library not found

Return type:

None

create_client_id()[source]

Returns an opaque identifier of a new TDLib instance

Return type:

int

execute(data)[source]

Executes a TDLib request

Parameters:

data (dict) – The request to be executed

Returns:

The result of the request

Return type:

:py:class:dict

receive(timeout=2.0)[source]

Receives incoming updates and results from TDLib

Parameters:

timeout (float, optional) – The maximum number of seconds allowed to wait for new data. Default is 2.0

Returns:

An incoming update or result to a request. If no data is received, None is returned

Return type:

:py:class:dict

send(client_id, data)[source]

Sends a request to TDLib

Parameters:
  • client_id (int) – TDLib Client identifier

  • data (dict) – Request to be sent

Return type:

None