def event_handler(loop, array, iterator):
print ('Итератор: ' + str(iterator) + ', Тип: '+ str(array[iterator]['type']) +', Время публикации: ' + str(array[iterator]['time']))
if __name__ == '__main__':
loop = asyncio.get_event_loop()
try:
print('Цикл событий запускается')
for iterator in range(len(posts)):
time_post_a = datetime.today()
time_post_a = int(time.mktime(time_post_a.timetuple()))
time_post_b = posts[iterator]['time']
time_post_b = int(time.mktime(time_post_b.timetuple()))
if (time_post_b > time_post_a):
time_post = time_post_b - time_post_a
loop.call_later(time_post, event_handler, loop, posts, iterator)
loop.run_forever()
finally:
print('Завершаю цикл событий')
loop.close()
"GET /static/js/ajax_form.js HTTP/1.1" 200 1681