Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atlassian.bitbucket.cloud.base.BitbucketCloudBase:raise_for_status() bug #1481

Open
bachew opened this issue Dec 13, 2024 · 1 comment
Open

Comments

@bachew
Copy link

bachew commented Dec 13, 2024

There's problem in atlassian.bitbucket.cloud.base.BitbucketCloudBase:raise_for_status() where it fails while constructing error message, causing real error to be hidden. This is the error I got:

Traceback (most recent call last):
  File "/home/chewbo/jenkins/jenkins-repos/venv/lib/python3.9/site-packages/atlassian/bitbucket/cloud/base.py", line 116, in raise_for_status
    error_msg += "\n" + e["detail"]
TypeError: can only concatenate str (not "dict") to str

My solution was simple, just use string interpolation:

# error_msg += "\n" + e["detail"]  # from this
error_msg = f"{error_msg}\n{e['detail']}"  # to this

After that I finally got the real error:

requests.exceptions.HTTPError: Your credentials lack one or more required privilege scopes.
{'required': ['pullrequest'], 'granted': ['webhook', 'repository:admin', 'repository:write', 'project', 'team']}

This can be reproduce by trying to create webhook with pullrequest:fulfilled event but without pullrequest access.

@Spacetown
Copy link
Contributor

Can you raise a PR for the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants