PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo¶
- class QWebEngineUrlRequestInfo¶
- The - QWebEngineUrlRequestInfoclass provides information about URL requests.- Details- The - QWebEngineUrlRequestInfois useful for setting extra header fields for requests, or for redirecting certain requests without payload data to another URL. This class cannot be instantiated or copied by the user; instead, it will be created by Qt WebEngine and sent through the virtual function- interceptRequest()if an interceptor has been set.- Synopsis¶- Methods¶- def - block()
- def - changed()
- def - firstPartyUrl()
- def - httpHeaders()
- def - initiator()
- def - isDownload()
- def - navigationType()
- def - redirect()
- def - requestBody()
- def - requestMethod()
- def - requestUrl()
- def - resourceType()
- def - setHttpHeader()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - class ResourceType¶
- This enum type holds the type of the requested resource: - Constant - Description - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeMainFrame - Top level page. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeSubFrame - Frame or iframe. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeStylesheet - A CSS stylesheet. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeScript - An external script. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeImage - An image (JPG, GIF, PNG, and so on). - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeFontResource - A font. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeSubResource - An “other” subresource. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeObject - An object (or embed) tag for a plugin or a resource that a plugin requested. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeMedia - A media resource. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeWorker - The main resource of a dedicated worker. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeSharedWorker - The main resource of a shared worker. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypePrefetch - An explicitly requested prefetch. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeFavicon - A favicon. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeXhr - An XMLHttpRequest. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypePing - A ping request for <a ping>. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeServiceWorker - The main resource of a service worker. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeCspReport - A report of Content Security Policy (CSP) violations. CSP reports are in JSON format and they are delivered by HTTP POST requests to specified servers. (Added in Qt 5.7) - QWebEngineUrlRequestInfo.ResourceType.ResourceTypePluginResource - A resource requested by a plugin. (Added in Qt 5.7) - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeNavigationPreloadMainFrame - A main-frame service worker navigation preload request. (Added in Qt 5.14) - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeNavigationPreloadSubFrame - A sub-frame service worker navigation preload request. (Added in Qt 5.14) - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeWebSocket - A WebSocket request. (Added in Qt 6.4) - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeUnknown - Unknown request type. - QWebEngineUrlRequestInfo.ResourceType.ResourceTypeJson - A JSON module. (Added in Qt 6.8) - Note - For forward compatibility all values not matched should be treated as unknown, not just - ResourceTypeUnknown.
 - This enum type describes the navigation type of the request: - Constant - Description - QWebEngineUrlRequestInfo.NavigationType.NavigationTypeLink - Navigation initiated by clicking a link. - QWebEngineUrlRequestInfo.NavigationType.NavigationTypeTyped - Navigation explicitly initiated by typing a URL. - QWebEngineUrlRequestInfo.NavigationType.NavigationTypeFormSubmitted - Navigation submits a form. - QWebEngineUrlRequestInfo.NavigationType.NavigationTypeBackForward - Navigation initiated by a history action. - QWebEngineUrlRequestInfo.NavigationType.NavigationTypeReload - Navigation initiated by refreshing the page. - QWebEngineUrlRequestInfo.NavigationType.NavigationTypeRedirect - Navigation triggered automatically by page content or remote server. (Added in Qt 5.14) - QWebEngineUrlRequestInfo.NavigationType.NavigationTypeOther - None of the above. 
 - block(shouldBlock)¶
- Parameters:
- shouldBlock – bool 
 
 - Blocks this request if - shouldBlockis true, so that it will not proceed.- This function can be used to prevent navigating away from a given domain, for example. - changed()¶
- Return type:
- bool 
 
 - Returns the first party URL of the request. The first party URL is the URL of the page that issued the request. - httpHeaders()¶
- Return type:
- Dictionary with keys of type .QByteArray and values of type QByteArray. 
 
 - Returns the request headers. - Note - Not all headers are visible at this stage as Chromium will add security and proxy headers at a later stage. - Returns the origin URL of the document that initiated the navigation of a frame to another frame. - isDownload()¶
- Return type:
- bool 
 
 - Returns true if the request was initiated by an explicit download action from the user. - A download can still occurs, even when this function return false. - Return type:
 
 - Returns the navigation type of the request. - See also - Redirects this request to - url.- Returns a pointer to a QIODevice that gives access to the request body. The request body can contain data for example when the request is a POST request. If the request body is empty, the QIODevice reflects this and does not return any data when performing read operations on it. - requestMethod()¶
- Return type:
 
 - Returns the HTTP method of the request (for example, GET or POST). - Returns the requested URL. - resourceType()¶
- Return type:
 
 - Returns the resource type of the request. - See also - setHttpHeader(name, value)¶
- Parameters:
- name – - QByteArray
- value – - QByteArray
 
 
 - Sets the request header - nameto- valuefor this request.