Skip to main content

在 Azure Cosmos DB (SQL API) 上运行的 Telethon 会话存储

项目描述

Telethon Cosmos DB SQL API 会话

这是一个使用 Cosmos DB (SQL API)的Telethon会话后端。

简而言之,它允许 Telethon 通过 SQL API 将会话存储在 Cosmos DB 中。

安装

pip3 install telethon-cosmosdb-sqlsession

升级

pip3 install -U telethon-cosmosdb-sqlsession

用法

from telethon import TelegramClient
from telethoncosmosdb import CosmosDBSQLSession

api_id = 123456
api_hash = "0123456789abcdef0123456789abcdef"
COSMOS_ENDPOINT = 'https://database-endpoint.documents.azure.com:443/'
COSMOS_KEY = 'Cosmos DB key here=='
COSMOS_DBNAME = 'database'

# The first parameter 'user' means the session will create containers with suffix 
# '_user' in the names to avoid any possible name collision (What would happen will happen).
session = CosmosDBSQLSession('user', COSMOS_ENDPOINT, COSMOS_KEY, COSMOS_DBNAME)
client = TelegramClient(session, api_id, api_hash)

免责声明

此包假定您的数据在 Cosmos DB 中得到很好的加密,因此不会加密您的会话数据。

此包装不提供任何保修。对于因使用此包装而造成的任何损害,我概不负责。

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

telethon-cosmosdb-sqlsession-0.1.1.tar.gz (4.3 kB 查看哈希

已上传 source

内置分布

telethon_cosmosdb_sqlsession-0.1.1-py3-none-any.whl (5.5 kB 查看哈希

已上传 py3