Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

schedule asyncio python

from datetime import datetime
import os

#pip3 install APScheduler
from apscheduler.schedulers.asyncio import AsyncIOScheduler

try:
    import asyncio
except ImportError:
    import trollius as asyncio


def big_work():
    print("i'm doing a big work")


if __name__ == '__main__':
    scheduler = AsyncIOScheduler()
    scheduler.add_job(big_work, 'interval', seconds=3)  # every sec
    scheduler.start()
    print('Press 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_forever()
    except (KeyboardInterrupt, SystemExit):
        pass
Comment

PREVIOUS NEXT
Code Example
Python :: how to replace single string in all dictionary keys in python 
Python :: python read arguments 
Python :: how to get user ip in python 
Python :: reset index with pandas 
Python :: how to change the column order in pandas dataframe 
Python :: Import "flask" could not be resolved 
Python :: array search with regex python 
Python :: how to get the live website html in python 
Python :: loop through 2 dataframes at once 
Python :: Resource punkt not found. Please use the NLTK Downloader to obtain the resource: 
Python :: read binary file python 
Python :: python check list contains another list 
Python :: how to make python speak 
Python :: get adjacent cells in grid 
Python :: get local python api image url 
Python :: python keyboard press 
Python :: pythom datetime now 
Python :: openpyxl write in cell 
Python :: django staff required 
Python :: random word python 
Python :: download pdf using python 
Python :: logging the terminal output to a file 
Python :: remove n from string python 
Python :: how to check if everything inside a list is unique 
Python :: get max value column pandas 
Python :: how to edit variables with functions in python 
Python :: iterar una lista en python 
Python :: python format decimal 
Python :: resample python numpy 
Python :: python utf8 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =