标签:des http os io strong for ar art div
Trigger alias for add_job(): date
Bases: apscheduler.triggers.base.BaseTrigger
Triggers once on the given datetime. If run_date is left empty, current time is used.
Parameters: |
|
---|
This is the simplest possible method of scheduling a job. It schedules a job to be executed once at the specified time. It is APScheduler’s equivalent to the UNIX “at” command.
The run_date can be given either as a date/datetime object or text (in the ISO 8601 format).
from datetime import date
from apscheduler.scheduler import BlockingScheduler
sched = BlockingScheduler()
def my_job(text):
print(text)
# The job will be executed on November 6th, 2009
sched.add_job(my_job, ‘date‘, run_date=date(2009, 11, 6), args=[‘text‘])
sched.start()
You can specify the exact time when the job should be run:
# The job will be executed on November 6th, 2009 at 16:30:05
sched.add_job(my_job, ‘date‘, run_date=datetime(2009, 11, 6, 16, 30, 5), args=[‘text‘])
The run date can be given as text too:
sched.add_job(my_job, ‘date‘, run_date=‘2009-11-06 16:30:05‘, args=[‘text‘])
To add a job to be run immediately:
# The ‘date‘ trigger and datetime.now() as run_date are implicit
sched.add_job(my_job, args=[‘text‘])
APScheduler API -- apscheduler.triggers.date
标签:des http os io strong for ar art div
原文地址:http://www.cnblogs.com/fendou-999/p/3935660.html