Skip to content

NetworkAccessManager

Qt Base Class: QNetworkAccessManager

Signature: QNetworkAccessManager(self, parent: Optional[PySide6.QtCore.QObject] = None) -> None

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object
QNetworkAccessManager
PySide6.QtNetwork
QNetworkAccessManager(self, parent: Optional[PySide6.QtCore.QObject] \= None) -> None

⋔ Inheritance diagram

graph TD
  1473572200800["network.NetworkAccessManager"]
  1473299815024["core.ObjectMixin"]
  140713234304496["builtins.object"]
  1473573788944["QtNetwork.QNetworkAccessManager"]
  1473288842240["QtCore.QObject"]
  1473291690208["Shiboken.Object"]
  1473299815024 --> 1473572200800
  140713234304496 --> 1473299815024
  1473573788944 --> 1473572200800
  1473288842240 --> 1473573788944
  1473291690208 --> 1473288842240
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: ObjectMixin, QNetworkAccessManager

Allows the application to send network requests and receive replies.

Source code in prettyqt\network\networkaccessmanager.py
class NetworkAccessManager(core.ObjectMixin, network.QNetworkAccessManager):
    """Allows the application to send network requests and receive replies."""

    # def request(
    #     self,
    #     method,
    #     url,
    #     headers=None,
    #     cookies=None,
    #     files=None,
    #     auth=None,
    #     timeout=None,
    #     allow_redirects=True,
    # ):
    #     req = network.NetworkRequest()
    #     if allow_redirects:
    #         pass

    def get(self, request: datatypes.UrlType | network.QNetworkRequest):
        if isinstance(request, str):
            request = core.Url(request)
        request = network.NetworkRequest(request)
        return super().get(request)

    # def post(self, url, data=None, json=None):
    #     pass

    # def put(self, url, data=None, json=None):
    #     pass

    # def patch(self, url, data=None):
    #     pass

    # def delete(self, url):
    #     pass

    def set_redirect_policy(
        self,
        policy: network.networkrequest.RedirectPolicyStr
        | network.NetworkRequest.RedirectPolicy,
    ):
        """Set redirect policy.

        Args:
            policy: redirect policy
        """
        self.setRedirectPolicy(
            network.networkrequest.REDIRECT_POLICIES.get_enum_value(policy)
        )

    def get_redirect_policy(self) -> network.networkrequest.RedirectPolicyStr:
        """Get the current redirect policy.

        Returns:
            redirect policy
        """
        return network.networkrequest.REDIRECT_POLICIES.inverse[self.redirectPolicy()]

get_redirect_policy() -> network.networkrequest.RedirectPolicyStr

Get the current redirect policy.

Source code in prettyqt\network\networkaccessmanager.py
def get_redirect_policy(self) -> network.networkrequest.RedirectPolicyStr:
    """Get the current redirect policy.

    Returns:
        redirect policy
    """
    return network.networkrequest.REDIRECT_POLICIES.inverse[self.redirectPolicy()]

set_redirect_policy(policy: network.networkrequest.RedirectPolicyStr | network.NetworkRequest.RedirectPolicy)

Set redirect policy.

Parameters:

Name Type Description Default
policy RedirectPolicyStr | RedirectPolicy

redirect policy

required
Source code in prettyqt\network\networkaccessmanager.py
def set_redirect_policy(
    self,
    policy: network.networkrequest.RedirectPolicyStr
    | network.NetworkRequest.RedirectPolicy,
):
    """Set redirect policy.

    Args:
        policy: redirect policy
    """
    self.setRedirectPolicy(
        network.networkrequest.REDIRECT_POLICIES.get_enum_value(policy)
    )

⌗ Property table

Qt Property Type Doc
objectName QString