From 514118e916582f78a4fef10a4ff619784b804ee1 Mon Sep 17 00:00:00 2001 From: HhH666-ux Date: Fri, 6 Nov 2026 23:05:58 +0800 Subject: [PATCH 1/2] fix(bitbucket): use the configured base_url Build the file and listing URLs from the configured base_url instead of the hardcoded api.bitbucket.org host, and cover the configured URL through the HTTP boundary in the unit test. --- .../bitbucket/bitbucket_client.py | 2 +- .../test_bitbucket_prompt_manager.py | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/bitbucket/bitbucket_client.py b/litellm/integrations/bitbucket/bitbucket_client.py index e4f5a50550e..7549bae6fcd 100644 --- a/litellm/integrations/bitbucket/bitbucket_client.py +++ b/litellm/integrations/bitbucket/bitbucket_client.py @@ -80,7 +80,7 @@ class BitBucketClient: self.repository = config.get("repository") self.access_token = config.get("access_token") self.branch = config.get("branch", "main") - self.base_url = config.get("", "https://api.bitbucket.org/2.0") + self.base_url = config.get("base_url", "https://api.bitbucket.org/2.0") self.auth_method = config.get("auth_method", "token") self.username = config.get("username") diff --git a/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py b/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py index a1a88653ee6..75afaeaaccd 100644 --- a/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py +++ b/tests/unit/integrations/bitbucket/test_bitbucket_prompt_manager.py @@ -2,7 +2,9 @@ import json import re from unittest.mock import MagicMock, patch +import httpx import pytest +import respx from litellm.integrations.bitbucket.bitbucket_client import BitBucketClient @@ -65,6 +67,25 @@ def test_bitbucket_client_initialization(): assert client_basic.username == "test-user" +def test_bitbucket_client_uses_configured_base_url(): + config = { + "workspace": "test-workspace", + "repository": "test-repo", + "access_token": "test-token", + "base_url": "https://bitbucket.example.com/2.0", + } + + with respx.mock: + respx.get( + "https://bitbucket.example.com/2.0/repositories/test-workspace/test-repo/src/main/prompts/test.prompt" + ).mock(return_value=httpx.Response(200, text="prompt", headers={"content-type": "text/plain"})) + client = BitBucketClient(config) + + content = client.get_file_content("prompts/test.prompt") + + assert content == "prompt" + + def test_bitbucket_client_missing_required_fields(): """Test BitBucketClient initialization with missing required fields.""" with pytest.raises( From e8683d1eaf5dde5c235745234ca989eaf5bebffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B5=E5=A4=A7=E8=80=81baby?= <3231811510@qq.com> Date: Sat, 7 Nov 2026 13:11:52 +0800 Subject: [PATCH 2/2] docs(bitbucket): note that base_url must stay Cloud-2.0 compatible --- litellm/integrations/bitbucket/bitbucket_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/integrations/bitbucket/bitbucket_client.py b/litellm/integrations/bitbucket/bitbucket_client.py index 7549bae6fcd..89c2c5c27c3 100644 --- a/litellm/integrations/bitbucket/bitbucket_client.py +++ b/litellm/integrations/bitbucket/bitbucket_client.py @@ -72,7 +72,10 @@ class BitBucketClient: - repository: Repository name - access_token: BitBucket access token (or app password) - branch: Branch to fetch from (default: main) - - base_url: Custom BitBucket API base URL (optional) + - base_url: Custom BitBucket API base URL (optional). Must stay + compatible with the Bitbucket Cloud 2.0 path scheme; Bitbucket Data + Center (Server) REST APIs use different paths and are not supported + by this client. - auth_method: Authentication method ('token' or 'basic', default: 'token') - username: Username for basic auth (optional) """