Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Demonstrates how to use the asyncio compatible scheduler to schedule a job that executes on 3
- second intervals.
- """
- import asyncio
- import os
- from datetime import datetime
- import time
- from apscheduler.schedulers.asyncio import AsyncIOScheduler
- date_bitch = str(input('Введи время: '))
- text_bitch = str(input('Введи текст: '))
- async def bla(date_bitch, text_bitch):
- print(date_bitch)
- print(text_bitch)
- time_now = str(time.strftime("%Y-%m-%d ", time.localtime()))
- time_now += date_bitch
- print(time_now)
- scheduler = AsyncIOScheduler()
- scheduler.add_job(check, 'date', run_date=time_now, args = [text_bitch])
- scheduler.start()
- async def check(text_bitch):
- print('Poshlo Poehalo')
- for x in range(10):
- time = str(time.strftime("%M:%S", time.localtime()))
- print(f'#{x} |Чек. Текст: {text_bitch}, время сейчас: {time}.')
- print(str(time.strftime("%M:%S", time.localtime())))
- #bla(date_bitch, text_bitch)
- if __name__ == '__main__':
- #scheduler = AsyncIOScheduler()
- #scheduler.add_job(tick, 'cron', day='*' , hour='*' , minute='*' , second='*/1')
- #scheduler.start()
- print('Go go go Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
- # Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed.
- try:
- asyncio.get_event_loop().run_until_complete(bla(date_bitch, text_bitch))
- #asyncio.get_event_loop().run()
- except (KeyboardInterrupt, SystemExit):
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement