Closed blacksteel1288 closed 3 months ago
This is expected. The docs for PLAYWRIGHT_PROCESS_REQUEST_HEADERS
were updated in the 0.0.41 release, and a note about the deprecation was added: https://github.com/scrapy-plugins/scrapy-playwright/tree/v0.0.41?tab=readme-ov-file#deprecated-argument-handling
This is in order to be able to pass additional request information, not just the headers: https://github.com/scrapy-plugins/scrapy-playwright/pull/303
Thanks. Is there any action I need to take then, to remove the warnings from the log?
Yes, refactor your custom_headers
function to receive the three keyword arguments that are specified in the docs.
Great. I might add, as a tip for the docs:
from typing import Dict
I'm getting a deprecation warning from Scrapy for the custom_headers approach in the docs.
This just started happening this week.
[py.warnings] WARNING: /usr/local/lib/python3.12/dist-packages/scrapy_playwright/handler.py:751: ScrapyDeprecationWarning: Accepting positional arguments in the function passed to the PLAYWRIGHT_PROCESS_REQUEST_HEADERS setting is deprecated. The function should accept three (3) keyword arguments instead: browser_type_name: str, playwright_request: playwright.async_api.Request, scrapy_request_data: dict