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"]
# patch config
cnt = 0
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")
cnt += 1
print(f"*** [OK] {k} success")
print(result)
print(result.text)
print("")
else:
print(f"*** [] {k} failed")
print(f"*** [!!] {k} failed")
print(result)
print(result.reason)
print(result.text)
print("")
print(f"- {cnt} / {len(p) - 1} succeeded.")
if __name__ == "__main__":
sys.exit(main(sys.argv))