T
T
tem12qaz2020-12-22 02:02:43
Flask
tem12qaz, 2020-12-22 02:02:43

How to use aiogram webhook?

I started to study the aiogram library. Decided to use webhook with Flask.
But I have a question, if the aiogram library is asynchronous, does it need an asynchronous server? For example AIOHTTP.
Does it make sense to use asynchronous aiogram along with synchronous Flask?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxs2x, 2020-12-23
@tem12qaz

aiogram and Flask shouldn't be related at all! It's like hammering nails with a screwdriver.
aiogram - an asynchronous library based on AIOHTTP
AIOHTTP - a framework for creating ASYNCHRONOUS web applications
Flask - a framework for creating SYNCHRONOUS web applications
aiogram already has a server (when you start the written bot, the aiohttp server also starts). Together with aiogram, you can use Nginx or Apache to proxy requests (if you have several bots or if it’s more convenient to send an ssl certificate to the telegram server to install webhook)
If you run the application on linux, you can simply use gunicorn (unlike Flask, which is always launched wsgi)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question