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:
parent
a718af5a0b
commit
69c28f1a3f
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue