QWebEngineUrlRequestInterceptor

The QWebEngineUrlRequestInterceptor class provides an abstract base class for URL interception. More

Inheritance diagram of PySide2.QtWebEngineCore.QWebEngineUrlRequestInterceptor

Detailed Description

Implementing the QWebEngineUrlRequestInterceptor interface and installing the interceptor on the profile enables intercepting, blocking, and modifying URL requests before they reach the networking stack of Chromium.

You can install the interceptor on a profile via setRequestInterceptor() or setRequestInterceptor() .

When using the Qt WebEngine Widgets Module , acceptNavigationRequest() offers further options to accept or block requests.

See also

interceptRequest() QWebEngineUrlRequestInfo

class QWebEngineUrlRequestInterceptor([p=Q_NULLPTR])
param p

QObject

Creates a new QWebEngineUrlRequestInterceptor object with p as parent.

PySide2.QtWebEngineCore.QWebEngineUrlRequestInterceptor.interceptRequest(info)
Parameters

infoQWebEngineUrlRequestInfo

Reimplementing this virtual function makes it possible to intercept URL requests. This function is executed on the IO thread, and therefore running long tasks here will block networking.

info contains the information about the URL request and will track internally whether its members have been altered.

Warning

All method calls to the profile on the main thread will block until execution of this function is finished.