inngest / inngest-py

Python SDK for Inngest
https://www.inngest.com/docs/reference/python
Apache License 2.0
22 stars 4 forks source link

scheduled function #132

Open guldo111 opened 1 week ago

guldo111 commented 1 week ago

Hey i'm creating a scheduled function with python sdk, but i receive this error:

TypeError: Inngest.create_function() got an unexpected keyword argument 'cron'

this is the code i am using:

import inngest

inngest_client = inngest.Inngest(
    app_id="my_app",
    is_production=os.getenv("INNGEST_DEV") is None,
)

@inngest_client.create_function(
    fn_id="my_function",
    cron="0 8 * * *"  
)

does python sdk support cron? or am i doing something wrong? thanks

goodoldneon commented 1 week ago

It supports crons! You'll need to use the inngest.TriggerCron class:

import inngest

inngest_client = inngest.Inngest(
    app_id="my_app",
)

@inngest_client.create_function(
    fn_id="my_function",
    trigger=inngest.TriggerCron(cron="0 8 * * *")
)

Also, is there reason why you're setting is_production=os.getenv("INNGEST_DEV") is None on the client? The INNGEST_DEV env var should be automatic