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]:
|
||||
response = await client.get("/domains/")
|
||||
if httpx.codes.is_success(response.status_code):
|
||||
if response.is_success:
|
||||
data = response.json()
|
||||
if isinstance(data, list):
|
||||
for entry in data:
|
||||
@ -37,7 +37,7 @@ class VscaleDomains(BaseOutputProvider):
|
||||
response = await client.get(
|
||||
f"/domains/{domain_id}/records/",
|
||||
)
|
||||
if httpx.codes.is_success(response.status_code):
|
||||
if response.is_success:
|
||||
data = response.json()
|
||||
if isinstance(data, list):
|
||||
for entry in data:
|
||||
@ -50,7 +50,7 @@ class VscaleDomains(BaseOutputProvider):
|
||||
|
||||
async def get_record_value(self, client, domain_id, record_id) -> str:
|
||||
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()
|
||||
if isinstance(data, dict):
|
||||
return data["content"]
|
||||
@ -68,7 +68,7 @@ class VscaleDomains(BaseOutputProvider):
|
||||
f"/domains/{domain_id}/records/{record_id}",
|
||||
json=data,
|
||||
)
|
||||
if not httpx.codes.is_success(response.status_code):
|
||||
if not response.is_success:
|
||||
raise RuntimeError(
|
||||
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/",
|
||||
json=data,
|
||||
)
|
||||
if not httpx.codes.is_success(response.status_code):
|
||||
if not response.is_success:
|
||||
raise RuntimeError(
|
||||
f"failed to create record: {self.target=},{domain_id=}, {record_type=}, {value=}, {response.status_code=}"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user