如何为APScheduler 3.0传递UTC时区?

mis*_*p_n 3 python heroku apscheduler

这里有Heroku的人吗?看来他们的系统无法执行标记为cron的APScheduler的操作。仅供参考:我正在使用免费软件包。使用此示例,间隔将运行,而cron将不运行。还有其他人遇到吗?

编辑:建议我指定UTC,但我不确定如何使用add_job进行操作。有参加者吗?因为我知道这目前不正确:

from apscheduler.schedulers.blocking import BlockingScheduler
from pytz import utc

sched = BlockingScheduler(timezone=utc)

def grabit():
    print "This job is run every weekday"

def tick():
    print "every 5 minutes"

sched.add_job(grabit, 'cron', day_of_week='mon-fri', hour=0, minute=13, id="get_things", replace_existing=True)
sched.add_job(tick, 'interval', minutes=5)
sched.start()
Run Code Online (Sandbox Code Playgroud)

Dar*_*ght 5

您可以像这样传递字符串:

sched = BlockingScheduler(timezone="Asia/Kolkata")
Run Code Online (Sandbox Code Playgroud)

并使用thisL查找字符串

from tzlocal import get_localzone
tz = get_localzone()
print(tz)
Run Code Online (Sandbox Code Playgroud)

该对象将包含字符串