Skip to content

Commit

Permalink
ISS-334 pass api key from BITBUCKET_API_URL env var.
Browse files Browse the repository at this point in the history
  • Loading branch information
matt- committed Mar 7, 2024
1 parent 571a766 commit 58f645c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ci/bitbucket/bitbucket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class BitbucketClient:
def __init__(self, api_token, base_url="https://api.bitbucket.org/2.0"):
def __init__(self, api_token, base_url="https://api.bitbucket.org/2.0/"):
self.headers = {
"Accept": "application/json",
"Authorization": f"Bearer {api_token}",
Expand All @@ -11,7 +11,7 @@ def __init__(self, api_token, base_url="https://api.bitbucket.org/2.0"):

def _make_request(self, method, url, data=None, **kwargs):
"""Generic method to make HTTP requests"""
full_url = f"{self.base_url}/{url}"
full_url = f"{self.base_url}{url}"
response = requests.request(
method, full_url, json=data, headers=self.headers, timeout=10, **kwargs
)
Expand Down Expand Up @@ -71,7 +71,7 @@ def commit_file(
data = {"branch": branch, "message": commit_message}
files = {file_path: content}
url = f"repositories/{workspace}/{repo_slug}/src"
full_url = f"{self.base_url}/{url}"
full_url = f"{self.base_url}{url}"
response = requests.post(
full_url, data=data, files=files, headers=self.headers, timeout=10
)
Expand Down
2 changes: 1 addition & 1 deletion ci/bitbucket/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
with open(filename, "r", encoding="utf-8") as file:
data = json.load(file)

bitbucket = BitbucketClient(api_token)
bitbucket = BitbucketClient(api_token, api_url)

# get info about the current pull request
pull_request_info = bitbucket.get_pull_request_info(
Expand Down

0 comments on commit 58f645c

Please sign in to comment.