-
I have a telegram bot, it is written in python (uses the aiogram library), it works on a webhook. I need to process payments for a paid subscription to a bot (I use yoomoney as a payment). It’s clear how you can do this on Flask: through its request method, catch http notifications that are sent from yoomoney (you can specify a url for notifications in yoomoney, where payment statuses like "payment.succeeded" should come) In short, Flask is able to check the status of a payment. The bottom line is that the bot is written in aiogram and the bot is launched by the command:
And if you just write in this code the launch of the application on flask in order to listen for answers from yoomoney, then EITHER the commands (of the bot itself) from aiogram will be executed OR the launch of flask, depending on what comes first in the code. In fact, it is impossible to use flask and aiogram at the same time without multithreading. Is it possible somehow without flask in aiogram to track what comes to my server from another server (yoomoney)? Or how to use the aiogram + flask bundle more competently? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
you can use aiohttp that user in aiogram for get requests from payment providers |
Beta Was this translation helpful? Give feedback.
-
So, just use |
Beta Was this translation helpful? Give feedback.
-
Hello, Mate. Faced with the same problem. How did you solve the problem of running aiohttp.web and aiogram polling together? |
Beta Was this translation helpful? Give feedback.
flask
- sync webserveraiohttp
- async webserveraiogram
- async framework based onaiohttp
aiogram
andflask
are not compatibleSo, just use
aiohttp
instead