Skip to content

Commit cb4d68c

Browse files
fix(live_streaming): use base endpoint for create_bucket and create_stream
Fixed authentication failures for create_bucket and create_stream by changing from bucket subdomain URLs to base endpoint URLs: - create_bucket: https://bucket.endpoint → https://endpoint/bucket - create_stream: https://bucket.endpoint/stream → https://endpoint/bucket/stream This matches the URL pattern used by other working methods like list_streams and list_buckets, which use the base endpoint instead of bucket subdomains. Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: callmefisher <[email protected]>
1 parent 7b665c3 commit cb4d68c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/mcp_server/core/live_streaming/live_streaming.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,19 @@ async def create_bucket(self, bucket: str) -> Dict[str, Any]:
8686
Returns:
8787
Dict containing the response status and message
8888
"""
89-
url = self._build_bucket_url(bucket)
89+
# Use base endpoint instead of bucket subdomain for creation
90+
if not self.live_endpoint:
91+
self.live_endpoint = "mls.cn-east-1.qiniumiku.com"
92+
93+
# Remove protocol if present
94+
endpoint = self.live_endpoint
95+
if endpoint.startswith("http://"):
96+
endpoint = endpoint[7:]
97+
elif endpoint.startswith("https://"):
98+
endpoint = endpoint[8:]
99+
100+
# Use base endpoint with bucket as path component
101+
url = f"https://{endpoint}/{bucket}"
90102
headers = self._get_auth_header(method="PUT",url=url)
91103

92104
logger.info(f"Creating bucket: {bucket} at {url}")
@@ -126,7 +138,19 @@ async def create_stream(self, bucket: str, stream: str) -> Dict[str, Any]:
126138
Returns:
127139
Dict containing the response status and message
128140
"""
129-
url = self._build_stream_url(bucket, stream)
141+
# Use base endpoint instead of bucket subdomain for creation
142+
if not self.live_endpoint:
143+
self.live_endpoint = "mls.cn-east-1.qiniumiku.com"
144+
145+
# Remove protocol if present
146+
endpoint = self.live_endpoint
147+
if endpoint.startswith("http://"):
148+
endpoint = endpoint[7:]
149+
elif endpoint.startswith("https://"):
150+
endpoint = endpoint[8:]
151+
152+
# Use base endpoint with bucket/stream as path components
153+
url = f"https://{endpoint}/{bucket}/{stream}"
130154
headers = self._get_auth_header(method="PUT", url=url)
131155

132156
logger.info(f"Creating stream: {stream} in bucket: {bucket} at {url}")

0 commit comments

Comments
 (0)