feat(collect): add product status recheck
This commit is contained in:
@@ -1207,6 +1207,27 @@ def collect(account, task, on_step=None) -> dict:
|
||||
return result
|
||||
|
||||
|
||||
def recheck_product_status(account, task, on_step=None) -> dict:
|
||||
"""Read one product status snapshot without changing collected content."""
|
||||
|
||||
item_id = _item_id(task)
|
||||
cdp = open_product(account, item_id, on_step=on_step, bring_to_front=False)
|
||||
result = None
|
||||
try:
|
||||
_notify_collect_step(on_step, "read_product_status")
|
||||
result = read_product_status(cdp)
|
||||
if result.get("product_status_error"):
|
||||
raise EditorError(
|
||||
"商品状态读取失败:{error}".format(
|
||||
error=result["product_status_error"]
|
||||
)
|
||||
)
|
||||
finally:
|
||||
close_target_confirmed = _close_collected_product(cdp)
|
||||
result["close_target_confirmed"] = close_target_confirmed
|
||||
return result
|
||||
|
||||
|
||||
def read_product_status(cdp) -> dict:
|
||||
"""Read the current product's warning state without retaining page HTML."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user