add DomainBlock type hint to update_known_block().

Use ._asdict() to get info to pass to add block API call.
This commit is contained in:
Justin Warren 2023-01-13 17:31:50 +11:00
parent a718af5a0b
commit 69c28f1a3f
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -417,13 +417,13 @@ def is_change_needed(oldblock: dict, newblock: dict, import_fields: list):
change_needed = oldblock.compare_fields(newblock, import_fields) change_needed = oldblock.compare_fields(newblock, import_fields)
return change_needed 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""" """Update an existing domain block with information in blockdict"""
api_path = "/api/v1/admin/domain_blocks/" api_path = "/api/v1/admin/domain_blocks/"
try: try:
id = blockdict['id'] id = block.id
blockdata = blockdict.copy() blockdata = block._asdict()
del blockdata['id'] del blockdata['id']
except KeyError: except KeyError:
import pdb import pdb