Отправляет сообщение бот, а потом вылетает ошибка RuntimeError: Event loop is closed.'
def get_titles(checklist):
lists = []
for site in checklist.items():
html_text = requests.get(site[1][0]).text
tree = lxml.html.document_fromstring(html_text)
text_titles = str(*tree.xpath(site[1][1]))
text_link = site[1][3]
text_link += str(*tree.xpath(site[1][2]))
lists.extend([text_titles, text_link])
return lists
from aiogram import Bot, Dispatcher, executor, types
logging.basicConfig(level=logging.INFO)
bot = Bot(token=config.TOKEN)
dp = Dispatcher(bot)
users = [489955744, 515569637]
async def gg(users):
l = ['site']
while True:
if get_titles(checklist)[17:40] not in l:
for i in users:
await bot.send_message(i,get_titles(checklist))
l.append(get_titles(checklist)[17:40])
asyncio.run(gg(users))