🗝
about summary refs log tree commit diff
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-07-30 12:58:25 -0700
committermia <mia@mia.jetzt>2024-07-30 12:58:25 -0700
commitf0606a08799663f12f7999945980dc1df06fe048 (patch)
tree704d7b702beb5c1a16299930519e3cc01b4bbaaa
parent1d3ae7d37838be13b7c5dc28f0657577eeaff759 (diff)
downloadzoner-f0606a08799663f12f7999945980dc1df06fe048.tar.gz
zoner-f0606a08799663f12f7999945980dc1df06fe048.zip
replace requests with httpx
-rw-r--r--PKGBUILD6
-rw-r--r--pyproject.toml4
-rw-r--r--zoner.py12
3 files changed, 11 insertions, 11 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 0ca8b12..61492ba 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,9 +1,9 @@
 pkgname=zoner
-pkgver=1
-pkgrel=2
+pkgver=2
+pkgrel=1
 arch=(any)
 makedepends=(python-build python-installer python-wheel)
-depends=(python-requests)
+depends=(python-httpx)
 source=(pyproject.toml zoner.py compdef.zsh)
 sha256sums=(SKIP SKIP SKIP)
 license=(MIT)
diff --git a/pyproject.toml b/pyproject.toml
index 98d75e4..0b4d932 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,7 @@
 [project]
 name = "zoner"
-version = "1"
-dependencies = ["requests"]
+version = "2"
+dependencies = ["httpx"]
 
 [project.scripts]
 zoner = "zoner:main"
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"],