Skip to main content

Tiny asyncio-based telgram api wrapper library

Project description

# aiotelegram
Tiny asyncio-based telgram api wrapper library.

## Reasons
* [aiotg](https://github.com/szastupov/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`](https://github.com/KeepSafe/aiohttp).
* Proxy available (via [`aiohttp`](https://github.com/KeepSafe/aiohttp) [`ProxyConnector`](http://aiohttp.readthedocs.io/en/stable/client_reference.html#aiohttp.ProxyConnector)).
* `snake_case` api converted to telegram `camelCase`.
* Polling `offset` handled for you via `get_updates` method.
* Source code is [short and simple](https://github.com/pohmelie/aiotelegram/blob/master/aiotelegram.py).

## Usage
### Polling updates
```python
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
```python
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.0.tar.gz (2.2 kB view hashes)

Uploaded Source

Built Distribution

aiotelegram-0.1.0-py3-none-any.whl (3.9 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