Skip to main content

‍⚕ WIP: Async Bot API Adapters ‍⚕

This package allows to interact with vk and telegram API using the same interface.

It’s main purpose is to simply switch 🕹 between services while developing bots.

Setup

Firstly you should export environment variables. Create .env file and fill vars:

TELEGRAM_TOKEN=telegram_token
VK_TOKEN=vk_token

Example

Upload Images to vk and tg.

import asyncio

import aiofiles

from adapters.factory import create_adapter
from adapters.enums import AdapterType
from dotenv import load_dotenv
load_dotenv()

tg_adapter = create_adapter(adapter_type=AdapterType.TELEGRAM)
vk_adapter = create_adapter(adapter_type=AdapterType.VK)


async def main():
    async with aiofiles.open('test.png', mode='rb') as data:
        content = await data.read()
        await asyncio.gather(*[
                tg_adapter.send_image(chat_id=-195789610, image=content),
                vk_adapter.send_image(chat_id=2000000006, image=content)
        ])

asyncio.run(main())

Metadata

Release files for async-bot-api-adapters 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for async-bot-api-adapters 0.0.1
File Size Uploaded Provenance
async-bot-api-adapters-0.0.1.tar.gz 4.5 kB Without provenance Details

Release files / async-bot-api-adapters-0.0.1.tar.gz

Download URL async-bot-api-adapters-0.0.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d55e2edf100560cb2be057d1dd2ea7c78894e15d4800087c6e407c9e8949685e
BLAKE2b-256 checksum
How to use checksums
4c3299927904017aafa5736e183e8f9e0f8da0a175457c07e90af31f3551fc26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.1

Security for async-bot-api-adapters 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page