I tried to use Atlassian Python library to create a comment for my PR and failed.
from atlassian import Bitbucket
bb = Bitbucket(
url='https://api.bitbucket.org',
username='anton_merzliakov',
password='<app-password>')
resp = bb.add_pull_request_comment('<project>', '<repo>', '<pr-id>', 'new comment')
The authentication definitely works correctly because some API calls work, just not the add_pull_request_comment
Using a debugger I found out what happened. The server returned:
{
"type": "error",
"error": {
"message": "Bad request",
"fields": {
"text": "extra keys not allowed",
"content": "required key not provided"
}
}
}This is the very same error message I was getting trying to create a comment manually: https://community.atlassian.com/t5/Bitbucket-questions/Creating-a-PR-comment-via-REST-API/qaq-p/2406796 If the library itself doesn't know what keys to use, I definitely don't.
So, maybe I'm using an old version of the Python library? Maybe there's a workaround? Does Atlassian even support its Python library?