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)
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