Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

flask run function every minute

import time
import atexit

from apscheduler.schedulers.background import BackgroundScheduler


def print_date_time():
    print(time.strftime("%A, %d. %B %Y %I:%M:%S %p"))


scheduler = BackgroundScheduler()
scheduler.add_job(func=print_date_time, trigger="interval", seconds=60)
scheduler.start()

# Shut down the scheduler when exiting the app
atexit.register(lambda: scheduler.shutdown())
Comment

PREVIOUS NEXT
Code Example
Python :: why does async def not work python 
Python :: get top feature gridsearchcv 
Python :: concatenate the next row to the previous row pandas 
Python :: pandas dtodays date csv 
Python :: network setting for virtualbox kali 
Python :: py ocmpare strings 
Python :: Use of Pass 
Python :: how to use displacy 
Python :: let in python 
Python :: pade python 
Python :: which company has the largest servers 
Python :: form a chakravyuh matrix python 
Python :: python web app with redis github 
Python :: comprehension list iloc pandas 
Python :: python add new line from textarea 
Python :: appending hdf5 files 
Python :: How to put a header title per dataframe after concatenate using pandas in python 
Python :: how to set time.sleep(2) on instapy 
Python :: creating a frequency table | generating a frequency table 
Python :: Separating a relational plot based on a sixth variable | seaborn relational plot 
Python :: fibonacci sequence python genorator 
Python :: make my own rabbit bomb using python 
Python :: using default as none in django mdoels 
Python :: filtros en python (no contiene) 
Python :: poython inl linrt dor loop 
Python :: mechanize python XE #28 
Python :: Notice there is a bug when using astimezone() on utc time. This gives an incorrect result: 
Python :: python urllib.request.urlretrieve with a progressbar 
Python :: uri beecrowd problem 1047 Game Time with Minutes 
Python :: pairplot markersize 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =