use get_response_json in get_category_products
Adds the body guard this site lacked; a non-dict body now logs and returns before the fan-out instead of raising on searchTotalCount.
This commit is contained in:
1 parent
c6c606b504
commit
4dd4494435
1 file changed
+7
-2
@@ -14,7 +14,7 @@ from monitor_utils.runner import (
|
||||
run_bounded_cycle,
|
||||
setup_monitor_logging,
|
||||
)
|
||||
from monitor_utils.sessions import send_request
|
||||
from monitor_utils.sessions import get_response_json, send_request
|
||||
from motor.motor_asyncio import AsyncIOMotorCollection
|
||||
|
||||
setup_monitor_logging(monitor="samsung_shop")
|
||||
@@ -73,7 +73,12 @@ async def get_category_products(
|
||||
headers={"content-type": "application/x-www-form-urlencoded"},
|
||||
)
|
||||
|
||||
data = response.json()
|
||||
data = get_response_json(
|
||||
response, logger=LOGGER, category=category_id, offset=offset
|
||||
)
|
||||
if data is None:
|
||||
return
|
||||
|
||||
if offset != 0:
|
||||
await process_page(data, category_id, offset, collection)
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user