[Answered ]-Positional argument error in sheduling task in python

1👍

The function you pass to the schedule (you named it "paystack_webhookS") must be defined without any arguments.

def paystack_webhookS():
    ...

Your code doesn’t tell where the "request" variable is coming from. But if it is not global but already defined when the schedule tasks are initialized, you could work with a wrapper function creating your actual schedule function:

def createScheduleFunction(requestParameter):
    def __func():
        user = requestParameter.user
        ...
    return func

And then:

schedule.every(10).seconds.do(createScheduleFunction(request))

Leave a comment