skip to Main Content

python aiogram how to stop an asynchronous loop – Telegram API

Simple example import asyncio import logging from aiogram import Bot, Dispatcher, types logging.basicConfig(level=logging.INFO) token = 'token' bot = Bot(token=token) dp = Dispatcher(bot=bot) @dp.callback_query_handler(text='stoploop') async def stop_loop(query: types.CallbackQuery): # TODO how to stop test loop? await query.message.edit_text('stop') @dp.callback_query_handler(text='test') async def start_loop(query:…

VIEW QUESTION

Slow futures.ProcessPoolExecutor: how to improve? – Debian

I'm trying to understand why the following code is so slow: import threading import time import concurrent.futures from datetime import datetime def dump(txt): print(f'[{datetime.now()}] ({threading.get_ident():05}) {txt}n', end='') def sleep_(_): dump('Start') time.sleep(0.1) dump('Stop') def main(n=10, processes=10): dump('before with') with concurrent.futures.ProcessPoolExecutor(processes) as…

VIEW QUESTION

pip3 Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate – CentOS

I installed python3.7 from here https://tecadmin.net/install-python-3-6-on-centos/ When trying to use/upgrade/install pip I got the following error: [cloudera@quickstart Python-3.7.6rc1]$ sudo pip3 install --upgrade WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.…

VIEW QUESTION

Python telegram bot doesn't recognize text message – Telegram API

Here I have a code for making a simple echo bot for telegram. from telegram.ext import Updater, CommandHandler, MessageHandler, Filters import logging from data.constants import API_TOKEN, LOGGING_FORMAT logging.basicConfig(format=LOGGING_FORMAT, level=logging.DEBUG) updater = Updater(token=API_TOKEN) dispatcher = updater.dispatcher def start(update, context): context.bot.send_message(chat_id=update.effective_chat.id, text='Hello,…

VIEW QUESTION
Back To Top
Search