Back

How to send webhook even after a minute as specified times in appwrite function [python]

  • 0
  • Functions
  • Cloud
CodingXeer01
12 May, 2024, 12:35
TypeScript
import time
    
def main(context):

    if context.req.method == "POST":
        context.log(context.req.body)
        data = json.loads(context.req.body)
        count = data.get('rq')


        for i in range(0, count):
            context.log(i)
            time.sleep(2)

        return context.res.send("200")
    else:
        return context.res.send("400")

is it right way to do this, Im getting error when there is more than 7-10 count.

TL;DR
To send a webhook at specified times using the Appwrite function in Python, developers can use the provided code snippet. However, the error occurs when there are more than 7-10 counts due to long delays in the loop. Consider optimizing the delay mechanism or breaking down the process into smaller chunks to avoid the issue.
CodingXeer01
12 May, 2024, 12:35

How to send webhook even after a minute as specified times in appwrite function [python]

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more