enhance: use urllib join instead of fstring (#9549)

This commit is contained in:
Byron.wang 2024-10-21 19:04:28 +08:00 committed by GitHub
commit 37fea072bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import os
from urllib.parse import urljoin
import requests
@ -15,8 +16,7 @@ class EnterpriseRequest:
@classmethod
def send_request(cls, method, endpoint, json=None, params=None):
headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key}
url = f"{cls.base_url}{endpoint}"
url = urljoin(cls.base_url, endpoint)
response = requests.request(method, url, json=json, params=params, headers=headers, proxies=cls.proxies)
return response.json()