QWebEngineUrlRequestInfo#
The QWebEngineUrlRequestInfo
class provides information about URL requests. More…
Synopsis#
Functions#
def
block
(shouldBlock)def
changed
()def
firstPartyUrl
()def
httpHeaders
()def
initiator
()def
navigationType
()def
redirect
(url)def
requestMethod
()def
requestUrl
()def
resourceType
()def
setHttpHeader
(name, value)
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
Detailed Description#
The QWebEngineUrlRequestInfo
is 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.
- class PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo#
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.ResourceType#
This enum type holds the type of the requested resource:
Constant
Description
QWebEngineUrlRequestInfo.ResourceTypeMainFrame
Top level page.
QWebEngineUrlRequestInfo.ResourceTypeSubFrame
Frame or iframe.
QWebEngineUrlRequestInfo.ResourceTypeStylesheet
A CSS stylesheet.
QWebEngineUrlRequestInfo.ResourceTypeScript
An external script.
QWebEngineUrlRequestInfo.ResourceTypeImage
An image (JPG, GIF, PNG, and so on).
QWebEngineUrlRequestInfo.ResourceTypeFontResource
A font.
QWebEngineUrlRequestInfo.ResourceTypeSubResource
An “other” subresource.
QWebEngineUrlRequestInfo.ResourceTypeObject
An object (or embed) tag for a plugin or a resource that a plugin requested.
QWebEngineUrlRequestInfo.ResourceTypeMedia
A media resource.
QWebEngineUrlRequestInfo.ResourceTypeWorker
The main resource of a dedicated worker.
QWebEngineUrlRequestInfo.ResourceTypeSharedWorker
The main resource of a shared worker.
QWebEngineUrlRequestInfo.ResourceTypePrefetch
An explicitly requested prefetch.
QWebEngineUrlRequestInfo.ResourceTypeFavicon
A favicon.
QWebEngineUrlRequestInfo.ResourceTypeXhr
An XMLHttpRequest .
QWebEngineUrlRequestInfo.ResourceTypePing
A ping request for <a ping>.
QWebEngineUrlRequestInfo.ResourceTypeServiceWorker
The main resource of a service worker.
QWebEngineUrlRequestInfo.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.ResourceTypePluginResource
A resource requested by a plugin. (Added in Qt 5.7)
QWebEngineUrlRequestInfo.ResourceTypeNavigationPreloadMainFrame
A main-frame service worker navigation preload request. (Added in Qt 5.14)
QWebEngineUrlRequestInfo.ResourceTypeNavigationPreloadSubFrame
A sub-frame service worker navigation preload request. (Added in Qt 5.14)
QWebEngineUrlRequestInfo.ResourceTypeWebSocket
A WebSocket request. (Added in Qt 6.4)
QWebEngineUrlRequestInfo.ResourceTypeUnknown
Unknown request type.
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.NavigationTypeLink
Navigation initiated by clicking a link.
QWebEngineUrlRequestInfo.NavigationTypeTyped
Navigation explicitly initiated by typing a URL.
QWebEngineUrlRequestInfo.NavigationTypeFormSubmitted
Navigation submits a form.
QWebEngineUrlRequestInfo.NavigationTypeBackForward
Navigation initiated by a history action.
QWebEngineUrlRequestInfo.NavigationTypeReload
Navigation initiated by refreshing the page.
QWebEngineUrlRequestInfo.NavigationTypeRedirect
Navigation triggered automatically by page content or remote server. (Added in Qt 5.14)
QWebEngineUrlRequestInfo.NavigationTypeOther
None of the above.
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.block(shouldBlock)#
- Parameters:
shouldBlock – bool
Blocks this request if shouldBlock
is true, so that it will not proceed.
This function can be used to prevent navigating away from a given domain, for example.
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.changed()#
- Return type:
bool
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.firstPartyUrl()#
- Return type:
Returns the first party URL of the request. The first party URL is the URL of the page that issued the request.
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.httpHeaders()#
- Return type:
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.
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.initiator()#
- Return type:
Returns the origin URL of the document that initiated the navigation of a frame to another frame.
- Return type:
Returns the navigation type of the request.
See also
NavigationType
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.redirect(url)#
- Parameters:
url –
PySide6.QtCore.QUrl
Redirects this request to url
. It is only possible to redirect requests that do not have payload data, such as GET requests.
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.requestMethod()#
- Return type:
Returns the HTTP method of the request (for example, GET or POST).
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.requestUrl()#
- Return type:
Returns the requested URL.
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.resourceType()#
- Return type:
Returns the resource type of the request.
See also
ResourceType
- PySide6.QtWebEngineCore.QWebEngineUrlRequestInfo.setHttpHeader(name, value)#
- Parameters:
name –
PySide6.QtCore.QByteArray
value –
PySide6.QtCore.QByteArray
Sets the request header name
to value
for this request.