Я решаю аналогичные задачи с помощью
selenium-wire:
Features
~~~~~~~~
* Pure Python, user-friendly API
* HTTP and HTTPS requests captured
* Intercept requests and responses
* Modify headers, parameters, body content on the fly
* Capture websocket messages
* HAR format supported
* Proxy server support