Skip to content

WebEngineHttpRequest

Qt Base Class: QWebEngineHttpRequest

Signature: QWebEngineHttpRequest(self, other: PySide6.QtWebEngineCore.QWebEngineHttpRequest) -> None QWebEngineHttpRequest(self, url: Union[PySide6.QtCore.QUrl, str] = Default(QUrl), method: PySide6.QtWebEngineCore.QWebEngineHttpRequest.Method = Instance(PySide6.QtWebEngineCore.QWebEngineHttpRequest.Get)) -> None

Base classes

Name Children Inherits
QWebEngineHttpRequest
PySide6.QtWebEngineCore
QWebEngineHttpRequest(self, other: PySide6.QtWebEngineCore.QWebEngineHttpRequest) -> None

⋔ Inheritance diagram

graph TD
  1473574744448["webenginecore.WebEngineHttpRequest"]
  1473574734688["QtWebEngineCore.QWebEngineHttpRequest"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473574734688 --> 1473574744448
  1473291690208 --> 1473574734688
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QWebEngineHttpRequest

Source code in prettyqt\webenginecore\webenginehttprequest.py
class WebEngineHttpRequest(QtWebEngineCore.QWebEngineHttpRequest):
    def __repr__(self):
        return f"{type(self).__name__}({self.get_url()})"

    def set_headers(self, headers: dict[str, str]):
        for k, v in headers.items():
            self.setHeader(core.QByteArray(k.encode()), core.QByteArray(v.encode()))

    def get_headers(self) -> dict[str, str]:
        return {h.data().decode(): self.header(h).data().decode() for h in self.headers()}

    def set_url(self, url: datatypes.UrlType):
        url = core.Url(url)
        self.setUrl(url)

    def get_url(self) -> core.Url:
        return core.Url(self.url())

    def get_post_data(self) -> str:
        return self.postData().data().decode()

    def set_method(
        self, method: MethodStr | QtWebEngineCore.QWebEngineHttpRequest.Method
    ):
        """Set method this WebEngine request is using.

        Args:
            method: method
        """
        self.setMethod(METHODS.get_enum_value(method))

    def get_method(self) -> MethodStr:
        """Get the method this WebEngine request is using.

        Returns:
            method
        """
        return METHODS.inverse[self.method()]

get_method() -> MethodStr

Get the method this WebEngine request is using.

Source code in prettyqt\webenginecore\webenginehttprequest.py
def get_method(self) -> MethodStr:
    """Get the method this WebEngine request is using.

    Returns:
        method
    """
    return METHODS.inverse[self.method()]

set_method(method: MethodStr | QtWebEngineCore.QWebEngineHttpRequest.Method)

Set method this WebEngine request is using.

Parameters:

Name Type Description Default
method MethodStr | Method

method

required
Source code in prettyqt\webenginecore\webenginehttprequest.py
def set_method(
    self, method: MethodStr | QtWebEngineCore.QWebEngineHttpRequest.Method
):
    """Set method this WebEngine request is using.

    Args:
        method: method
    """
    self.setMethod(METHODS.get_enum_value(method))