Skip to main content

Simple and fast client to call rest-api endpoints `api.telegram.org` using `aiohttp` package.

Project description

Telegram Bot API - Python SDK (using aiohttp)

pytest asyncio, aiohttp Chat on Telegram Last Release

Simple and fast client to call rest-api endpoints api.telegram.org using aiohttp package.

View at: https://test.pypi.org/project/python-telegram-bot-api

How to install

pip3 install python-telegram-bot-api

Usage

import asyncio
from telegrambotapi import TgBotJson


TGBOT_TOKEN = "12345:YOUR_TOKEN"
APP_HOSTNAME = "https://YOUR_HOSTNAME.ngrok.io"
CHAT_ID = 123456789  # your chat id

client_tgbot = TgBotJson(token=TGBOT_TOKEN)


async def main_async():
    response = await app.client_tgbot.setWebhook("{hostname}/tgbot/wh".format(hostname=APP_HOSTNAME))
    r = await response.json()
    print(r)

    response = await app.client_tgbot.sendMessage(CHAT_ID, "Hello from Telegram Bot!")
    r = await response.json()
    print(r)


if __name__ == "__main__":
    asyncio.run_until_complete(main_async())

Docs

  1. How to publish pypi package Medium article in Russian

Disclaimer

This project and its author is neither associated, nor affiliated with Telegram in anyway. See License section for more details.

License

This project is released under the GNU LESSER GENERAL PUBLIC LICENSE 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

python-telegram-bot-api-0.0.1.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

python_telegram_bot_api-0.0.1-py3-none-any.whl (15.7 kB view hashes)

Uploaded Python 3

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