Skip to main content

Python Telegram Bot Api Wrapper.

Project description

telegrambotapiwrapper

Python Telegram Bot API wrapper

What is telegrambotapiwrapper?

telegramapiwrapper is the simplest Telegram Bot Api wrapper for Python among existing wrappers.

Requirements

Python 3.7

Installation

pip install telegrambotapiwrapper

Getting started.

Создание бота

Вы должны создать бота и получить токен

Testing your bot's auth token

Воспользуемся методом getMe

>>> from telegrambotapiwrapper.wrapper import Api
>>> bot_api = Api(token="<insert bot's auth token>")
>>> me = bot_api.get_me()
>>> print("me: {}".format(me)
me: User(id=123456789, is_bot=True, first_name='myrfffrbot', last_name=None, username='myrfffrbot', language_code=None)
>>> print("isinstance(me, User): {}".format(isinstance(me, User)))
isinstance(me, User): True

Sending text message

Sending audio file

Sending

Writing first bot

# firstbot.py
from telegrambotapiwrapper.wrapper import Api
from telegrambotapiwrapper.typelib import User

TOKEN = "<past_your_bot_api_token>"

bot_api = Api(token=TOKEN)
me = bot_api.get_me()
print("me: {}".format(me))
print("isinstance(me, User): {}".format(isinstance(me, User)))  # see type of result

Result:

(venv) dzmitry@mycomp:~$ python3 firstbot.py 
me: User(id=123456789, is_bot=True, first_name='myrfffrbot', last_name=None, username='myrfffrbot', language_code=None)
isinstance(me, User): True
(venv) dzmitry@mycomp:~$

Examples

Setting webhook

Sending message

Sending file

Using proxies

License

MIT License Copyright (c) 2019 Dzmitry Maliuzhenets

See LICENSE for details.

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

telegrambotapiwrapper-0.0.3.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

telegrambotapiwrapper-0.0.3-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: telegrambotapiwrapper-0.0.3.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for telegrambotapiwrapper-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e720f721c4f6a73e2e7295dd5f1c05f1f85e50142c20c36c4aa336542398e13f
MD5 c89ee5ee89974db77d15fce0212fc715
BLAKE2b-256 3b1a3b6e2aeb97ccca14c74b7548cc87743baa607a227906b6471bdebd853e23

See more details on using hashes here.

File details

Details for the file telegrambotapiwrapper-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: telegrambotapiwrapper-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 35.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2

File hashes

Hashes for telegrambotapiwrapper-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d879c1dd9948ee998c882f222712e5da1ba0c8f4112ea6e0df74a28754eb9c00
MD5 8697e5530ba3bacebbc2ce65759e7e99
BLAKE2b-256 ffe885a7015515b10c7e9d42637d18da2463cf523998ac432e722e8c1006285e

See more details on using hashes here.

Supported by

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