By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when using 'page.on("request", function)' to intercept request, and the target site is jiyan. the page is always loading.

aim url like " http://xypt.mwr.cn/ "

Looked into this a bit.

There haven't been any changes in Network manager from 0.2.2 to 0.0.25.

But with 0.0.25 there is newer version of pyee and 'EventEmitter'. With 0.2.2. pyppeteer uses older version (7.0.4). Pyppeteer 0.0.25. uses pyee 8.1.0.

There have been changes in EventEmitter.on and most likely are the source of broken behaviour with page.on("request" ..... ).

page.on works when downgrading pyee to 7.0.4. with pip install 'pyee==7.0.4' --force-reinstall

I'm not that familiar with pyppeteer development but hope this directs someone in right direction.

Can you verify that you're continuing or aborting the request in the interceptor function?

@Mattwmaster58 I continue to listen to incoming responses. I don't have any abort/break in my interceptor function. With pyvee 7.0.4. it works but not with 8.1.0.

This is simple interceptor function to capture response details:

async def intercept_network_response(response):
        print("URL:", response.url)
        print("Method:", response.request.method)
        print("Response headers:", response.headers)
        print("Request Headers:", response.request.headers)

with 7.0.4. it will nicely print all the details about every response object.

With 8.1.0 it seem to return an Response object:

<pyppeteer.network_manager.Response at 0x7ffc7f2d72d0>