diff options
Diffstat (limited to 'zoner.py')
-rw-r--r-- | zoner.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/zoner.py b/zoner.py index f4d4b1c..7772384 100644 --- a/zoner.py +++ b/zoner.py @@ -1,7 +1,7 @@ from pathlib import Path import tomllib import os -import requests +import httpx import subprocess import sys @@ -78,15 +78,15 @@ def update_rules(rules: dict, statement: str): raise ValueError(f"invalid rule {key}") -def check_porkbun(resp: requests.Response): +def check_porkbun(resp: httpx.Response): if resp.status_code >= 400: - raise requests.HTTPError( + raise httpx.HTTPError( f"got code {resp.status_code}: {resp.json()}", response=resp ) def retrieve(domain: str): - resp = requests.post( + resp = httpx.post( f"https://porkbun.com/api/json/v3/dns/retrieve/{domain}", json={"apikey": cfg["api_key"], "secretapikey": cfg["secret_key"]}, ) @@ -156,7 +156,7 @@ def balance(domain: str): for record in to_delete: print(f"delete {record}") - resp = requests.post( + resp = httpx.post( f"https://porkbun.com/api/json/v3/dns/delete/{domain}/{record.meta['id']}", json={"apikey": cfg["api_key"], "secretapikey": cfg["secret_key"]}, ) @@ -168,7 +168,7 @@ def balance(domain: str): prio = None if record.kind == "MX": prio, content = content.split(" ") - resp = requests.post( + resp = httpx.post( f"https://porkbun.com/api/json/v3/dns/create/{domain}", json={ "apikey": cfg["api_key"], |