You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! Why do I get an error if ResponseReceived works, I get the real request id and it has a status code 200?
Error getting body No resource with given identifier found
command:Network.getResponseBody
params:{'requestId': RequestId('3980.82')} [code: -32000]
`
class RequestMonitor:
def __init__(self):
# Храним пары [URL, request_id]
self.requests: list[list[str | cdp.network.RequestId]] = []
self.last_request: float | None = None
self.lock = asyncio.Lock()
async def listen(self, page: uc.Tab):
async def handler(evt: cdp.network.ResponseReceived):
async with self.lock:
# Отслеживаем только XHR-ответы с ненулевым размером данных
if "goldapple.ru/front/api/catalog/products" in evt.response.url:
self.requests.append([evt.response.url, evt.request_id])
print(evt.request_id.to_json())
self.last_request = time.time()
page.add_handler(cdp.network.ResponseReceived, handler)
async def receive(self, page: uc.Tab):
responses: list[ResponseType] = []
print("Реквесты: ", self.requests)
for request in self.requests:
try:
if not isinstance(request[1], cdp.network.RequestId):
raise ValueError('Request ID is not of type RequestId')
res = await page.send(cdp.network.get_response_body(request[1]))
if res is None:
continue
responses.append({
'url': request[0],
'body': res[0],
'is_base64': res[1]
})
except Exception as e:
print('Error getting body', e)
return responses
`
The text was updated successfully, but these errors were encountered:
Hi! Why do I get an error if ResponseReceived works, I get the real request id and it has a status code 200?
Error getting body No resource with given identifier found
command:Network.getResponseBody
params:{'requestId': RequestId('3980.82')} [code: -32000]
The text was updated successfully, but these errors were encountered: