Skip to main content

Python Wrapper TDLib

Description

A simple Python TDLib Wrapper (pywtdlib) that makes you easy to create new Python Telegram clients.

Installation

  1. By pip3
pip3 install pywtdlib

Setup

This project depends on TDLib. TDLib is the official cross-platform library for building Telegram clients written in C++.

Example:

This wrapper is so easy to use, for example the following code prints every new message that is received in your Telegram account.

from os import environ
from pywtdlib.client import Client
from pywtdlib.enum import Update
import logging

# (optional) set some logging to see what is happening under the hood
logging.basicConfig(
    filename="app.log",
    filemode="a",
    level=logging.INFO,
    format="%(asctime)s [%(filename)s:%(lineno)d]|%(levelname)s|%(message)s",
)

# 1. instantiate the telegram client (put your API_ID and API_HASH from https://my.telegram.org/apps)
tg = Client(api_id=environ["API_ID"], api_hash=environ["API_HASH"])

# 2. define an update handler (every time an update is received, it will execute it)
# this will print in console every new message received
def print_messages(event):
    if event["@type"] == Update.NEW_MESSAGE:
        print(event)


# 3. add the update handler
tg.set_update_handler(print_messages)

# 4. start the client (press CTRL + C to stop)
tg.start()

Libraries

In the lib/ folder are located the binaries for Windows and Linux. If you need other binaries or you want to build by your own, go to the TDLib build page.

Logs

Support for basic logging

Issues

If you detect a bug or you have a suggestion, open a ticket with the corresponding template.

Metadata

Release files for pywtdlib 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywtdlib 0.2.0
File Size Uploaded
pywtdlib-0.2.0.tar.gz 65.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pywtdlib 0.2.0
File Interpreter ABI Platform
pywtdlib-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 131.1 MB

Release files / pywtdlib-0.2.0.tar.gz

Download URL pywtdlib-0.2.0.tar.gz
Size 65.4 MB
Tags Source
SHA-256 checksum
How to use checksums
45994aae3796cf53041aa01e4d250d8d6b7131530b7f4581bcb4e48a4087ccfd
BLAKE2b-256 checksum
How to use checksums
524aed83ca316ca0481df69a4a56699fbdf22fcc42b527852dd519e210e11d34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / pywtdlib-0.2.0-py3-none-any.whl

Download URL pywtdlib-0.2.0-py3-none-any.whl
Size 65.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
48df5e90c6ebcf3634a54a3eac2ebf872c896f0002abb589bc15fd56c20973f1
BLAKE2b-256 checksum
How to use checksums
e535ff7049362f64f59dfe8d3a9815a139839de269ba2648ed9e227d6dfc67d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page