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_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:
#

View File

@ -12,7 +12,7 @@ bot = telebot.TeleBot(API_TOKEN)
WEBHOOK_SSL_CERT = './webhook_cert.pem' # Path to the ssl certificate
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:
#

View File

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

View File

@ -372,8 +372,8 @@ class TeleBot:
ssl_context = (certificate, certificate_key) if certificate else (None, None)
# webhooks module
try:
from telebot.extensions.synchronous import SyncWebhookListener
except NameError:
from telebot.ext.sync import SyncWebhookListener
except (NameError, ImportError):
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.run_app()

View File

@ -1515,8 +1515,8 @@ class AsyncTeleBot:
ssl_context = (certificate, certificate_key) if certificate else (None, None)
# for webhooks
try:
from telebot.extensions.asynchronous import AsyncWebhookListener
except NameError:
from telebot.ext.aio import AsyncWebhookListener
except (NameError, ImportError):
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)
await self.webhook_listener.run_app()