我正在编写一个简单的函数,它使用AsyncIOScheduler基于计划发送消息。
scheduler = AsyncIOScheduler()
scheduler.add_job(job, "cron", day_of_week="mon-fri", hour = "16")
scheduler.start()
看起来它是有效的,但我总是得到以下信息:
PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
PytzUsageWarning: The localize method is no longer necessary, as this time zone supports the fold attribute (PEP 495)
我对Python中的时间不熟悉,所以我不确定这条消息要我做什么。我访问了消息中提供的链接,但那里的解释对我来说太复杂了。据我理解,我需要迁移到使用PEP495,但我应该如何做到呢?
timezone
添加到 IntervalTrigger 中,而不是调度程序(我正在使用 BackgroundScheduler)以消除警告。 - virgesmith