Using the bitbucket update webhook

Viewed 11

So I'm creating a python script to Create/Delete/Update WebHooks, but I can't seem to figure out how the update_webhook(...) functions works. Lets say I just want to change the name of a WebHook, from WebHook1 to WebHook2, how can I do that?

My Create WebHook looks like this:

from atlassian import Bitbucket

bitbucket = Bitbucket(
    url="xxx",
    username= "xxx",    
    password = "xxx"
)

# Create
respond = bitbucket.create_webhook(
    project_key="Project_name", 
    repository_slug="repo_name", 
    name="WebHook1", 
    events=[
        'pr:merged', 
        'pr:reviewer:updated', 
        'pr:opened', 
        'repo:comment:added', 
        'repo:forked', 
        'repo:refs_changed', 
        'pr:declined', 
        'repo:comment:edited', 
        'pr:deleted', 
        'pr:comment:deleted', 
        'pr:from_ref_updated', 
        'repo:comment:deleted', 
        'pr:comment:edited', 
        'pr:reviewer:unapproved', 
        'pr:modified', 
        'mirror:repo_synchronized', 
        'pr:reviewer:needs_work', 
        'pr:reviewer:approved', 
        'repo:modified', 
        'pr:comment:added'], 
    webhook_url="URL LINK", 
    active="True")
print(respond)

What I'm trying is to update the name from "WebHook1" to "WebHook2", something like:

from atlassian import Bitbucket

bitbucket = Bitbucket(
    url="xxx",
    username= "xxx",    
    password = "xxx"
)

# Update
bitbucket.update_webhook("project_name", "Repo_name", "ID for WebHook1") # How to update name?

Is it even possible, or am I using a wrong function for this?

0 Answers
Related