fix: Remove id from export
As this wil not be the same id on other instances exporting it does not make sense
This commit is contained in:
parent
58998e1c17
commit
8a8a725002
@ -38,6 +38,9 @@ def load_blocklist_from_instance(server: str, token: str) -> [Instance]:
|
|||||||
else:
|
else:
|
||||||
raise ConnectionError(f"Could not connect to the server ({response.status_code}: {response.reason})")
|
raise ConnectionError(f"Could not connect to the server ({response.status_code}: {response.reason})")
|
||||||
|
|
||||||
|
def remove_key_from_dict(dict, key):
|
||||||
|
del dict[key]
|
||||||
|
return dict
|
||||||
|
|
||||||
def cli():
|
def cli():
|
||||||
parser = argparse.ArgumentParser(description='Deploy blocklist updates to a mastodon server')
|
parser = argparse.ArgumentParser(description='Deploy blocklist updates to a mastodon server')
|
||||||
@ -92,10 +95,10 @@ def cli():
|
|||||||
Instance.apply_blocks_from_diff(diffs, args.server, token, args.no_delete)
|
Instance.apply_blocks_from_diff(diffs, args.server, token, args.no_delete)
|
||||||
elif args.action == "export":
|
elif args.action == "export":
|
||||||
if not args.output:
|
if not args.output:
|
||||||
print(toml.dumps({"instances": [b.__dict__ for b in remote_blocklist]}))
|
print(toml.dumps({"instances": [remove_key_from_dict(b.__dict__, 'id') for b in remote_blocklist]}))
|
||||||
else:
|
else:
|
||||||
with open(args.output, "w") as f:
|
with open(args.output, "w") as f:
|
||||||
toml.dump({"instances": [b.__dict__ for b in remote_blocklist]}, f)
|
toml.dump({"instances": [remove_key_from_dict(b.__dict__, 'id') for b in remote_blocklist]}, f)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user