Skip to main content

Tiny asyncio-based telgram api wrapper library

Project description

Tiny asyncio-based telgram bot-api wrapper library.

Reasons

  • aiotg is framework, not library and have no proxy support.

  • Raw api calls translation is better for understanding and will not break if telegram api will be changed.

  • snake_case

Features

  • Simple as telegram api is.

  • Based on aiohttp.

  • Proxy available (via aiohttp ProxyConnector).

  • snake_case api converted to telegram camelCase.

  • Polling offset handled for you via get_updates method.

  • Handling timeout between requests automatically (via pause keyword-only argument).

  • Source code is short and simple.

Installation

python -m pip install aiotelegram

Usage

Polling updates

import aiotelegram


async def ...(...):

    api = aiotelegram.Api(token)
    while True:

        response = await api.get_updates()
        if not response["ok"]:

            ...

        else:

            for update in response["result"]:

                ...

        await asyncio.sleep(delay)

Sending message

async def ...(...):

    await api.send_message(
        chat_id=123456,
        text="*foobar*",
        parse_mode="Markdown",
    )

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

aiotelegram-0.1.2.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

aiotelegram-0.1.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file aiotelegram-0.1.2.tar.gz.

File metadata

  • Download URL: aiotelegram-0.1.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aiotelegram-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ec07cbffd80b105b6df016d3d5e36f8e3ea0e6990919a48af733d61fb1682d69
MD5 c05e4e836ed36675484a0c29b10f7d5c
BLAKE2b-256 1ddb04e9cd5dd7f7b17bc881a6c9bdf0fe7a2b90701fc45549a62a643af98734

See more details on using hashes here.

File details

Details for the file aiotelegram-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for aiotelegram-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 64389d774968757d345cfb8024fec6d9c07b51d38d3a9f5f2a3217cbbe9f309b
MD5 1d79c22f6f636ccc33d6c643723801b8
BLAKE2b-256 4b8c217a05389a7b96a0dd614a43f16952b668d752b5e6441eca46b9d00946c7

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