-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
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
Idea: mechanism for dumping out list of resources requested #88
Comments
One solution would be to provide an entirely new command. Another solution would be to have |
Demo of that prototype:
Would be useful if it also indicated the size of the response. Maybe even timing information too. |
New prototype, outputting JSON-nl with size and timings:
That's with this patch (now listening for the diff --git a/shot_scraper/cli.py b/shot_scraper/cli.py
index fb8b1a3..799be82 100644
--- a/shot_scraper/cli.py
+++ b/shot_scraper/cli.py
@@ -698,6 +698,10 @@ def take_shot(
if not use_existing_page:
page = context_or_page.new_page()
+ def on_response(response):
+ print(json.dumps({"url": response.url, "method": response.request.method, "size": len(response.body()), "timing": response.request.timing}))
+
+ page.on("response", on_response)
else:
page = context_or_page
|
I needed that here: simonw/datasette-lite#40 (comment)
I came up with this prototype patch:
Using this mechanism: https://playwright.dev/python/docs/network#handle-requests
The text was updated successfully, but these errors were encountered: