From 69c28f1a3ff2dcbb351f5a6740ab46b4d324ee22 Mon Sep 17 00:00:00 2001 From: Justin Warren Date: Fri, 13 Jan 2023 17:31:50 +1100 Subject: [PATCH] add DomainBlock type hint to update_known_block(). Use ._asdict() to get info to pass to add block API call. --- src/fediblockhole/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fediblockhole/__init__.py b/src/fediblockhole/__init__.py index 9977dc9..6cdf143 100755 --- a/src/fediblockhole/__init__.py +++ b/src/fediblockhole/__init__.py @@ -417,13 +417,13 @@ def is_change_needed(oldblock: dict, newblock: dict, import_fields: list): change_needed = oldblock.compare_fields(newblock, import_fields) return change_needed -def update_known_block(token: str, host: str, blockdict: dict): +def update_known_block(token: str, host: str, block: DomainBlock): """Update an existing domain block with information in blockdict""" api_path = "/api/v1/admin/domain_blocks/" try: - id = blockdict['id'] - blockdata = blockdict.copy() + id = block.id + blockdata = block._asdict() del blockdata['id'] except KeyError: import pdb