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"]
if "moderator" in p:
del p["moderator"]
if "ban_list" in p:
del p["ban_list"]
# patch config
result = requests.patch(f"{REST_PATH}/{pargs.list}/config", auth=rest_auth, json=p)
if result.ok:
print("success")
print(result)
print(result.text)
else:
print("failed")
print(result)
print(result.reason)
print(result.text)
for k, v in p.items():
result = requests.patch(f"{REST_PATH}/{pargs.list}/config", auth=rest_auth, json={k: v})
if result.ok:
print(f"*** [🆗] {k} success")
print(result)
print(result.text)
else:
print(f"*** [⚠] {k} failed")
print(result)
print(result.reason)
print(result.text)
if __name__ == "__main__":