mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-19 08:28:10 +02:00
parent
7eecadd8d6
commit
21e7fd8d78
2 changed files with 101 additions and 8 deletions
|
|
@ -263,10 +263,12 @@ class MPSServiceKeyClient:
|
|||
HTTPException: If the API call fails
|
||||
"""
|
||||
async with httpx.AsyncClient(timeout=self.timeout) as client:
|
||||
response = await client.post(
|
||||
f"{self.base_url}/api/v1/service-keys/usage",
|
||||
json={"service_key": service_key},
|
||||
headers=self._get_headers(organization_id, created_by),
|
||||
response = await client.get(
|
||||
f"{self.base_url}/api/v1/service-keys/usage/self",
|
||||
headers={
|
||||
"Authorization": f"Bearer {service_key}",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
|
|
@ -429,10 +431,12 @@ class MPSServiceKeyClient:
|
|||
"""
|
||||
try:
|
||||
with httpx.Client(timeout=self.timeout) as client:
|
||||
response = client.post(
|
||||
f"{self.base_url}/api/v1/service-keys/usage",
|
||||
json={"service_key": service_key},
|
||||
headers=self._get_headers(organization_id, created_by),
|
||||
response = client.get(
|
||||
f"{self.base_url}/api/v1/service-keys/usage/self",
|
||||
headers={
|
||||
"Authorization": f"Bearer {service_key}",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
)
|
||||
return response.status_code == 200
|
||||
except Exception:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue