chore: update send_request method to handle tenant_id in params

pull/17683/head
zhangx1n 1 year ago
parent 2409f991b6
commit e3deb37a47

@ -13,10 +13,10 @@ class EnterpriseRequest:
} }
@classmethod @classmethod
def send_request(cls, method, endpoint, json=None, params=None, tenant_id=None): def send_request(cls, method, endpoint, json=None, params=None):
headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key} headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key}
if tenant_id: if params["tenant_id"]:
headers["X-Tenant-ID"] = tenant_id headers["X-Tenant-ID"] = params["tenant_id"]
url = f"{cls.base_url}{endpoint}" url = f"{cls.base_url}{endpoint}"
response = requests.request(method, url, json=json, params=params, headers=headers, proxies=cls.proxies) response = requests.request(method, url, json=json, params=params, headers=headers, proxies=cls.proxies)
return response.json() return response.json()

@ -16,7 +16,7 @@ class WebAppSettings(BaseModel):
class EnterpriseService: class EnterpriseService:
@classmethod @classmethod
def get_info(cls, tenant_id=None): def get_info(cls, tenant_id=None):
return EnterpriseRequest.send_request("GET", "/info", tenant_id=tenant_id) return EnterpriseRequest.send_request("GET", "/info", params={"tenant_id": tenant_id})
class WebAppAuth: class WebAppAuth:
@classmethod @classmethod

Loading…
Cancel
Save