Add total counts to the end of import script

This commit is contained in:
Cassowary Rusnov 2024-02-28 08:43:50 -08:00
parent 4d4c7bc00d
commit 54c20a8c65

View File

@ -73,18 +73,23 @@ def main(args):
del p["ban_list"] del p["ban_list"]
# patch config # patch config
cnt = 0
for k, v in p.items(): for k, v in p.items():
result = requests.patch(f"{REST_PATH}/{pargs.list}/config", auth=rest_auth, json={k: v}) result = requests.patch(f"{REST_PATH}/{pargs.list}/config", auth=rest_auth, json={k: v})
if result.ok: if result.ok:
print(f"*** [🆗] {k} success") cnt += 1
print(f"*** [OK] {k} success")
print(result) print(result)
print(result.text) print(result.text)
print("")
else: else:
print(f"*** [] {k} failed") print(f"*** [!!] {k} failed")
print(result) print(result)
print(result.reason) print(result.reason)
print(result.text) print(result.text)
print("")
print(f"- {cnt} / {len(p) - 1} succeeded.")
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main(sys.argv)) sys.exit(main(sys.argv))