Individually patch each parameter rather than all at once, and indicate which ones succeed and which ones dont

This commit is contained in:
Cassowary Rusnov 2024-02-28 08:20:40 -08:00
parent e3867f1656
commit 4d4c7bc00d

View File

@ -69,18 +69,21 @@ def main(args):
del p["owner"] del p["owner"]
if "moderator" in p: if "moderator" in p:
del p["moderator"] del p["moderator"]
if "ban_list" in p:
del p["ban_list"]
# patch config # patch config
result = requests.patch(f"{REST_PATH}/{pargs.list}/config", auth=rest_auth, json=p) for k, v in p.items():
if result.ok: result = requests.patch(f"{REST_PATH}/{pargs.list}/config", auth=rest_auth, json={k: v})
print("success") if result.ok:
print(result) print(f"*** [🆗] {k} success")
print(result.text) print(result)
else: print(result.text)
print("failed") else:
print(result) print(f"*** [⚠] {k} failed")
print(result.reason) print(result)
print(result.text) print(result.reason)
print(result.text)
if __name__ == "__main__": if __name__ == "__main__":