From e9d3d7f0d9c923ed0e70d6fb817a1351dfed17c4 Mon Sep 17 00:00:00 2001 From: Eugenio Lacuesta Date: Sat, 6 Jul 2024 15:40:04 -0300 Subject: [PATCH] Document playwright_suggested_filename meta key in readme --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index a13923e5..d4ac9992 100644 --- a/README.md +++ b/README.md @@ -498,6 +498,19 @@ def parse(self, response, **kwargs): # {'issuer': 'DigiCert TLS RSA SHA256 2020 CA1', 'protocol': 'TLS 1.3', 'subjectName': 'www.example.org', 'validFrom': 1647216000, 'validTo': 1678838399} ``` +### `playwright_suggested_filename` +Type `Optional[str]`, read only + +The value of the [`Download.suggested_filename`](https://playwright.dev/python/docs/api/class-download#download-suggested-filename) +attribute when the response is the binary contents of a download (e.g. a PDF file) +Only available for responses that only caused a download. Could be accessed +in the callback via `response.meta['playwright_suggested_filename']` + +```python +def parse(self, response, **kwargs): + print(response.meta["playwright_suggested_filename"]) + # 'sample_file.pdf' +``` ## Receiving Page objects in callbacks