import asyncio
import concurrent.futures
_loop = asyncio.get_running_loop()
with concurrent.futures.ThreadPoolExecutor() as pool:
positions_to_order, ids_to_order = await _loop.run_in_executor(pool, sync_func, *args)
import requests
from bs4 import BeautifulSoup
def parse():
URL = 'https://my.ranepa.ru/pk/list.php?FT=1&FL=2&FK=&FC=...'
HEADERS = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.164 Safari/537.36'
}
response = requests.get(URL, headers=HEADERS)
soup = BeautifulSoup(response.content, "html.parser")
items = soup.findAll('div', class_='bigtable_wrap')
components = []
for item in items:
components.append({
'title': item.find('tbody').get_text(strip=True)
})
for component in components:
print(component['title'])
parse()
if number is None
и потом вы пытаетесь отправить None в сообщении, а как раз если deeplink есть, не важно цифры или текст, пользователь будет получать ответ 'Введите число ' try:
await bot.send_message(chat_id, 'text') #Эта строчка так и остается как у тебя в коде
except BotBlocked:
pass