Cron triggers are now supported in Python Workers
You can now create Python Workers which are executed via a cron trigger.
This is similar to how it's done in JavaScript Workers, simply define a scheduled event listener in your Worker:
from workers import handler
@handlerasync def on_scheduled(event, env, ctx): print("cron processed")
Define a cron trigger configuration in your Wrangler configuration file:
{ "triggers": { "crons": [ "*/3 * * * *", "0 15 1 * *", "59 23 LW * *" ] }}
[triggers]# Schedule cron triggers:# - At every 3rd minute# - At 15:00 (UTC) on first day of the month# - At 23:59 (UTC) on the last weekday of the monthcrons = [ "*/3 * * * *", "0 15 1 * *", "59 23 LW * *" ]
Then test your new handler by using Wrangler with the --test-scheduled
flag and
making a request to /cdn-cgi/handler/scheduled?cron=*+*+*+*+*
:
npx wrangler dev --test-scheduled
curl "http://localhost:8787/cdn-cgi/handler/scheduled?cron=*+*+*+*+*"
Consult the Workers Cron Triggers page for full details on cron triggers in Workers.
Was this helpful?
- Resources
- API
- New to Cloudflare?
- Products
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark