Skip to main content

Set of telegram pydantic models

Project description

telegram_pydantic - Set of Pydantic models, generated according to Telegram TL Scheme

PyPI version shields.io PyPI pyversions PyPI license

Layer 181

Example

from pydantic import TypeAdapter

from telegram_pydantic import base
from telegram_pydantic import types

ta = TypeAdapter(base.Message)  # Base Constructor

json_data = {
    "_": "types.Message",
    "id": 1,
    "peer_id": {"_": "types.PeerUser", "user_id": 1},
    "date": 1720715931,
    "message": "Hello, World!",
    "out": False,
    "mentioned": False,
    "media_unread": False,
    "silent": False,
    "post": False,
    "from_scheduled": False,
    "legacy": False,
    "edit_hide": False,
    "pinned": False,
    "noforwards": False,
    "invert_media": False,
    "offline": False,
    "saved_peer_id": {"_": "types.PeerUser", "user_id": 1},
    "entities": [],
    "restriction_reason": []
}

message = ta.validate_python(json_data)

print(isinstance(message, types.Message))  # True 

LICENSE

This project is licensed under the terms of the MIT license.

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

telegram_pydantic-0.181.1.tar.gz (198.7 kB view details)

Uploaded Source

Built Distribution

telegram_pydantic-0.181.1-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file telegram_pydantic-0.181.1.tar.gz.

File metadata

  • Download URL: telegram_pydantic-0.181.1.tar.gz
  • Upload date:
  • Size: 198.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for telegram_pydantic-0.181.1.tar.gz
Algorithm Hash digest
SHA256 3b36294f5aa5bea7bc2abb4e03bd6c6ff71678de842efb0847be4c2182fbd972
MD5 f5824be092eca41f2214993becdaef48
BLAKE2b-256 ffc23ee7e973d30c363fe31cd8e710106586f1714e212e614bb67912ee737294

See more details on using hashes here.

File details

Details for the file telegram_pydantic-0.181.1-py3-none-any.whl.

File metadata

File hashes

Hashes for telegram_pydantic-0.181.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d6e24029fb072481da37fadf1c2ed465f4caa2d4edf4fd6ff922f992e814a402
MD5 bfefce5000813a2e60b446d4862fbe82
BLAKE2b-256 93af2b18ea20b5129dbb4852d3eb93415c4d81724c5e9b27ee122a2e8a56f175

See more details on using hashes here.

Supported by

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