fix vscale response check
This commit is contained in:
parent
3e9142cd54
commit
0509ba9d63
@ -22,7 +22,7 @@ class VscaleDomains(BaseOutputProvider):
|
|||||||
|
|
||||||
async def find_domain_id(self, client) -> Optional[int]:
|
async def find_domain_id(self, client) -> Optional[int]:
|
||||||
response = await client.get("/domains/")
|
response = await client.get("/domains/")
|
||||||
if httpx.codes.is_success(response.status_code):
|
if response.is_success:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
if isinstance(data, list):
|
if isinstance(data, list):
|
||||||
for entry in data:
|
for entry in data:
|
||||||
@ -37,7 +37,7 @@ class VscaleDomains(BaseOutputProvider):
|
|||||||
response = await client.get(
|
response = await client.get(
|
||||||
f"/domains/{domain_id}/records/",
|
f"/domains/{domain_id}/records/",
|
||||||
)
|
)
|
||||||
if httpx.codes.is_success(response.status_code):
|
if response.is_success:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
if isinstance(data, list):
|
if isinstance(data, list):
|
||||||
for entry in data:
|
for entry in data:
|
||||||
@ -50,7 +50,7 @@ class VscaleDomains(BaseOutputProvider):
|
|||||||
|
|
||||||
async def get_record_value(self, client, domain_id, record_id) -> str:
|
async def get_record_value(self, client, domain_id, record_id) -> str:
|
||||||
response = await client.get(f"/domains/{domain_id}/records/{record_id}")
|
response = await client.get(f"/domains/{domain_id}/records/{record_id}")
|
||||||
if httpx.codes.is_success(response.status_code):
|
if response.is_success:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
if isinstance(data, dict):
|
if isinstance(data, dict):
|
||||||
return data["content"]
|
return data["content"]
|
||||||
@ -68,7 +68,7 @@ class VscaleDomains(BaseOutputProvider):
|
|||||||
f"/domains/{domain_id}/records/{record_id}",
|
f"/domains/{domain_id}/records/{record_id}",
|
||||||
json=data,
|
json=data,
|
||||||
)
|
)
|
||||||
if not httpx.codes.is_success(response.status_code):
|
if not response.is_success:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"failed to change record: {self.target=},{domain_id=}, {record_id=}, {record_type=}, {value=}"
|
f"failed to change record: {self.target=},{domain_id=}, {record_id=}, {record_type=}, {value=}"
|
||||||
)
|
)
|
||||||
@ -84,7 +84,7 @@ class VscaleDomains(BaseOutputProvider):
|
|||||||
f"/domains/{domain_id}/records/",
|
f"/domains/{domain_id}/records/",
|
||||||
json=data,
|
json=data,
|
||||||
)
|
)
|
||||||
if not httpx.codes.is_success(response.status_code):
|
if not response.is_success:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"failed to create record: {self.target=},{domain_id=}, {record_type=}, {value=}, {response.status_code=}"
|
f"failed to create record: {self.target=},{domain_id=}, {record_type=}, {value=}, {response.status_code=}"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user