wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 240 forks source link

Reduce traffic #688

Open johny322 opened 1 year ago

johny322 commented 1 year ago

I use proxy and try to reduce traffic through them. Added request_interceptor with request.abort() under certain conditions. But at the same time, the traffic goes through the proxy. For example, I want to disable all the requests with google hosts

def interceptor(request: Request):
    hosts_abort = [
          "google"
      ]
    if any ([request.host.__contains__(part) for part in hosts_abort]):
       request.abort()

after create driver object: driver.request_interceptor = interceptor But, in proxy history i saw, requests with google`s hosts through proxy. How can i change it?