Skip to content

WebEngineProfile

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object
QWebEngineProfile
PySide6.QtWebEngineCore
QWebEngineProfile(self, name: str, /, parent: PySide6.QtCore.QObject | None \= None) -> None

⋔ Inheritance diagram

graph TD
  1362609207["webenginecore.WebEngineProfile"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  2637280171["QtWebEngineCore.QWebEngineProfile"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  3227531497 --> 1362609207
  2751680898 --> 3227531497
  2637280171 --> 1362609207
  3984060476 --> 2637280171
  37984305 --> 3984060476
  2751680898 --> 37984305

🛈 DocStrings

Bases: ObjectMixin, QWebEngineProfile

Source code in prettyqt/webenginecore/webengineprofile.py
class WebEngineProfile(core.ObjectMixin, webenginecore.QWebEngineProfile):
    def set_persistent_cookie_policy(
        self, policy: PersistentCookiePolicyStr | mod.PersistentCookiesPolicy
    ):
        """Set the persistent cookie policy.

        Args:
            policy: persistent cookie policy
        """
        self.setPersistentCookiesPolicy(PERSISTENT_COOKIE_POLICY.get_enum_value(policy))

    def get_persistent_cookie_policy(self) -> PersistentCookiePolicyStr:
        """Return current persistent cookie policy.

        Returns:
            Persistent cookie policy
        """
        return PERSISTENT_COOKIE_POLICY.inverse[self.persistentCookiesPolicy()]

    def set_http_cache_type(self, typ: HttpCacheTypeStr | mod.HttpCacheType):
        """Set the http cache type.

        Args:
            typ: http cache type
        """
        self.setHttpCacheType(HTTP_CACHE_TYPE.get_enum_value(typ))

    def get_http_cache_type(self) -> HttpCacheTypeStr:
        """Return current http cache type.

        Returns:
            Http cache type
        """
        return HTTP_CACHE_TYPE.inverse[self.httpCacheType()]

    def install_url_scheme_handler(
        self,
        scheme: str,
        callback: Callable[[QWebEngineUrlRequestJob], Any],
    ):
        """Install a URL scheme handler."""
        handler = CallbackWebEngineUrlSchemeHandler(callback, parent=self)
        self.installUrlSchemeHandler(scheme.encode(), handler)

    def get_scripts(self) -> webenginecore.WebEngineScriptCollection:
        return webenginecore.WebEngineScriptCollection(self.scripts())

get_http_cache_type() -> HttpCacheTypeStr

Return current http cache type.

Source code in prettyqt/webenginecore/webengineprofile.py
def get_http_cache_type(self) -> HttpCacheTypeStr:
    """Return current http cache type.

    Returns:
        Http cache type
    """
    return HTTP_CACHE_TYPE.inverse[self.httpCacheType()]

Return current persistent cookie policy.

Source code in prettyqt/webenginecore/webengineprofile.py
def get_persistent_cookie_policy(self) -> PersistentCookiePolicyStr:
    """Return current persistent cookie policy.

    Returns:
        Persistent cookie policy
    """
    return PERSISTENT_COOKIE_POLICY.inverse[self.persistentCookiesPolicy()]

install_url_scheme_handler(scheme: str, callback: Callable[[QWebEngineUrlRequestJob], Any])

Install a URL scheme handler.

Source code in prettyqt/webenginecore/webengineprofile.py
def install_url_scheme_handler(
    self,
    scheme: str,
    callback: Callable[[QWebEngineUrlRequestJob], Any],
):
    """Install a URL scheme handler."""
    handler = CallbackWebEngineUrlSchemeHandler(callback, parent=self)
    self.installUrlSchemeHandler(scheme.encode(), handler)

set_http_cache_type(typ: HttpCacheTypeStr | mod.HttpCacheType)

Set the http cache type.

Parameters:

Name Type Description Default
typ HttpCacheTypeStr | HttpCacheType

http cache type

required
Source code in prettyqt/webenginecore/webengineprofile.py
def set_http_cache_type(self, typ: HttpCacheTypeStr | mod.HttpCacheType):
    """Set the http cache type.

    Args:
        typ: http cache type
    """
    self.setHttpCacheType(HTTP_CACHE_TYPE.get_enum_value(typ))

Set the persistent cookie policy.

Parameters:

Name Type Description Default
policy PersistentCookiePolicyStr | PersistentCookiesPolicy

persistent cookie policy

required
Source code in prettyqt/webenginecore/webengineprofile.py
def set_persistent_cookie_policy(
    self, policy: PersistentCookiePolicyStr | mod.PersistentCookiesPolicy
):
    """Set the persistent cookie policy.

    Args:
        policy: persistent cookie policy
    """
    self.setPersistentCookiesPolicy(PERSISTENT_COOKIE_POLICY.get_enum_value(policy))

:fa-brands-github: Show source on GitHub