Skip to main content

Sans io telegram api with couple io backends

Project description

# Sans io implementation of telegram api
Tiny telegram 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
* support both, sync and async ways to deal with io.
* Simple as telegram api is.
* `snake_case` api converted to telegram `camelCase`.
* Polling `offset` handled for you via `get_updates` method.
* Handling timeout between requests automatically (via `delay` keyword-only argument).
* Use any io backend you want.

## Implementation
[Sans io]( implementation based on generators
for simplifying flow and holding state. `siotelegram` have io backends based on:
* requests
* aiohttp
* [aiorequests](

## Example
``` python
import asyncio

import siotelegram

TOKEN = "token"

def requests_example():

api = siotelegram.RequestsTelegramApi(TOKEN)
response = api.get_updates()

async def aiohttp_example():

async with siotelegram.AioHTTPTelegramApi(TOKEN) as api:

response = await api.get_updates()

async def aiorequests_example():

api = siotelegram.AioRequestsTelegramApi(TOKEN)
response = await api.get_updates()

if __name__ == "__main__":

import time

# requests


# aiohttp
loop = asyncio.get_event_loop()


# aiorequests
import aiorequests
import concurrent
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:

loop = asyncio.get_event_loop()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for siotelegram, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size siotelegram-0.1.0-py3-none-any.whl (6.9 kB) File type Wheel Python version 3.6 Upload date Hashes View
Filename, size siotelegram-0.1.0.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page