Need to create a python script to create Webhook

I am working on a task where I need to create a web-hook in BitBucket on a create pull request event. It should trigger a python script where I shall be able to validate the contents that I receive from the event , parse it & then send the payload to Jenkins to invoke a job.

I am struggling to find a clean way to do this. What is the API URL that we need to set in the web-hook ? How does a URL invokes a python script ? Where do I need to keep that python script ? Any suggestions or pointers would we welcome.

@sunilkumar1, welcome to the Atlassian developer community.

The options are different for Bitbucket Cloud vs Bitbucket Data Center. Are you talking about bitbucket.org?