1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Divided async and sync versions into aio & sync folders

This commit is contained in:
_run 2022-07-09 22:30:36 +05:00
parent d67ee2a5c5
commit 90a90d4a34
10 changed files with 6 additions and 7 deletions

View File

@ -11,7 +11,7 @@ bot = AsyncTeleBot('TOKEN')
WEBHOOK_SSL_CERT = './webhook_cert.pem' # Path to the ssl certificate WEBHOOK_SSL_CERT = './webhook_cert.pem' # Path to the ssl certificate
WEBHOOK_SSL_PRIV = './webhook_pkey.pem' # Path to the ssl private key WEBHOOK_SSL_PRIV = './webhook_pkey.pem' # Path to the ssl private key
DOMAIN = '123.12.33.22' # either domain, or ip address of vps DOMAIN = '1.2.3.4' # either domain, or ip address of vps
# Quick'n'dirty SSL certificate generation: # Quick'n'dirty SSL certificate generation:
# #

View File

@ -12,7 +12,7 @@ bot = telebot.TeleBot(API_TOKEN)
WEBHOOK_SSL_CERT = './webhook_cert.pem' # Path to the ssl certificate WEBHOOK_SSL_CERT = './webhook_cert.pem' # Path to the ssl certificate
WEBHOOK_SSL_PRIV = './webhook_pkey.pem' # Path to the ssl private key WEBHOOK_SSL_PRIV = './webhook_pkey.pem' # Path to the ssl private key
DOMAIN = '123.12.33.22' # either domain, or ip address of vps DOMAIN = '1.2.3.4' # either domain, or ip address of vps
# Quick'n'dirty SSL certificate generation: # Quick'n'dirty SSL certificate generation:
# #

View File

@ -29,7 +29,6 @@ setup(name='pyTelegramBotAPI',
'redis': 'redis>=3.4.1', 'redis': 'redis>=3.4.1',
'aioredis': 'aioredis', 'aioredis': 'aioredis',
'aiohttp': 'aiohttp', 'aiohttp': 'aiohttp',
'flask': 'flask',
'fastapi': 'fastapi', 'fastapi': 'fastapi',
'uvicorn': 'uvicorn', 'uvicorn': 'uvicorn',
}, },

View File

@ -372,8 +372,8 @@ class TeleBot:
ssl_context = (certificate, certificate_key) if certificate else (None, None) ssl_context = (certificate, certificate_key) if certificate else (None, None)
# webhooks module # webhooks module
try: try:
from telebot.extensions.synchronous import SyncWebhookListener from telebot.ext.sync import SyncWebhookListener
except NameError: except (NameError, ImportError):
raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.") raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.")
self.webhook_listener = SyncWebhookListener(self, secret_token, listen, port, ssl_context, '/'+url_path, debug) self.webhook_listener = SyncWebhookListener(self, secret_token, listen, port, ssl_context, '/'+url_path, debug)
self.webhook_listener.run_app() self.webhook_listener.run_app()

View File

@ -1515,8 +1515,8 @@ class AsyncTeleBot:
ssl_context = (certificate, certificate_key) if certificate else (None, None) ssl_context = (certificate, certificate_key) if certificate else (None, None)
# for webhooks # for webhooks
try: try:
from telebot.extensions.asynchronous import AsyncWebhookListener from telebot.ext.aio import AsyncWebhookListener
except NameError: except (NameError, ImportError):
raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.") raise ImportError("Please install uvicorn and fastapi in order to use `run_webhooks` method.")
self.webhook_listener = AsyncWebhookListener(self, secret_token, listen, port, ssl_context, '/'+url_path, debug) self.webhook_listener = AsyncWebhookListener(self, secret_token, listen, port, ssl_context, '/'+url_path, debug)
await self.webhook_listener.run_app() await self.webhook_listener.run_app()