atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

[Bitbucket cloud] problems adding comment in a pull request

Open ivandw opened this issue 1 year ago • 0 comments

Hello there, im trying to generate a comment in a pull request using bitbucket cloud and im getting an error.

Steps to reproduce:

using this sample code block, im trying to generate a comment in the pull request 101 of some repo inside my org of bitbucket cloud.

from atlassian.bitbucket import Bitbucket
project="myproj"
repository="myrepo"
pull_request_id="101"
text="test"
bitbucket = Bitbucket(url="https://api.bitbucket.org", username="bitbucket-user", password="user-app-password")

bitbucket.add_pull_request_comment(project, repository, pull_request_id, text)

im getting this error:

- python3 post_comment.py

Traceback (most recent call last):
  File "post_comment.py", line 10, in <module>
    bitbucket.add_pull_request_comment(project, repository, pull_request_id, text)
  File "/opt/homebrew/lib/python3.11/site-packages/atlassian/bitbucket/__init__.py", line 1989, in add_pull_request_comment
    return self.post(url, data=body)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/atlassian/rest_client.py", line 333, in post
    response = self.request(
               ^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/atlassian/rest_client.py", line 257, in request
    self.raise_for_status(response)
  File "/opt/homebrew/lib/python3.11/site-packages/atlassian/rest_client.py", line 487, in raise_for_status
    raise HTTPError(error_msg, response=response)
requests.exceptions.HTTPError

atlassian-python-api version 3.41.0 Python version 3.11.4 pip version 23.2.1

any suggestions? i can confirm that the username and app password is working well since i can create the pr comment using curl with the same credentials.

Thanks in advice.

ivandw avatar Aug 18 '23 17:08 ivandw