Skip to main content

Python Telegram TDLib sync client

Project description

Telegaden

Description

Python Telegram TDLib sync client Python API for the tdlib library. It helps you build your own Telegram clients.

Installation

pip install telegaden

Example

from telega import TelegramTDLibClient
from telega.client import ProxyTypes


telegram_client = TelegramTDLibClient(
    api_id=777,
    api_hash='abc',
    phone='911',
    database_encryption_key='NAd62byYz7em',
    # see all parameters in source code
)

telegram_client.set_proxy('111.111.111.111', 8080, ProxyTypes.proxyTypeHttp)
# telegram_client.check_proxy()  # ping if you need

if not telegram_client.is_authorized():
    password = input('2 factor auth password (if you have): ')
    telegram_client.auth_request()
    sms_code = input('sms_code: ')
    telegram_client.send_sms_code(sms_code, password)

print(telegram_client.get_all_chats())

Logging

Just set config for 'telega' logger. Also you can set C++ logging level - TelegramTDLibClient(tdlib_log_level=3)

import logging.config


LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {'main': {'format': '[%(levelname)s] [%(asctime)s] [%(module)s:%(lineno)d] %(message)s',
                            'datefmt': '%d/%m/%Y %H:%M:%S'}},
    'handlers': {'console': {'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'main'}, },
    'loggers': {'telega': {'handlers': ['console'], 'propagate': False, 'level': 'INFO'}, }
}
logging.config.dictConfig(LOGGING)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telegaden-0.0.3.tar.gz (12.4 MB view details)

Uploaded Source

File details

Details for the file telegaden-0.0.3.tar.gz.

File metadata

  • Download URL: telegaden-0.0.3.tar.gz
  • Upload date:
  • Size: 12.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.7.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/2.7.17

File hashes

Hashes for telegaden-0.0.3.tar.gz
Algorithm Hash digest
SHA256 91f4fed5015dff8b510e478a44ae56773b69edeabdd2031baff803fc82e71b42
MD5 8218457776b18b121efcd15a828fb368
BLAKE2b-256 fbb270bec5f0668e05d1d5b9e91f1fcc2e2584305c9beafad9319b34f8d912f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page