Skip to content

NetworkCookie

Qt Base Class: QNetworkCookie

Signature: QNetworkCookie(self, name: Union[PySide6.QtCore.QByteArray, bytes] = Default(QByteArray), value: Union[PySide6.QtCore.QByteArray, bytes] = Default(QByteArray)) -> None QNetworkCookie(self, other: PySide6.QtNetwork.QNetworkCookie) -> None

Base classes

Name Children Inherits
QNetworkCookie
PySide6.QtNetwork
QNetworkCookie(self, name: Union[PySide6.QtCore.QByteArray, bytes] \= Default(QByteArray), value: Union[PySide6.QtCore.QByteArray, bytes] \= Default(QByteArray)) -> None

⋔ Inheritance diagram

graph TD
  1473573994880["network.NetworkCookie"]
  1473573868976["QtNetwork.QNetworkCookie"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473573868976 --> 1473573994880
  1473291690208 --> 1473573868976
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QNetworkCookie

Holds one network cookie.

Source code in prettyqt\network\networkcookie.py
class NetworkCookie(QtNetwork.QNetworkCookie):
    """Holds one network cookie."""

    def __repr__(self):
        return get_repr(self, self.name(), self.value())

    def to_raw_form(self, full: bool = True):
        form = RAW_FORMS["full"] if full else RAW_FORMS["name_and_value_only"]
        self.toRawForm(form)

    def set_name(self, name: datatypes.ByteArrayType):
        name = datatypes.to_bytearray(name)
        self.setName(name)

    def get_name(self) -> str:
        return self.name().data().decode()

    def set_value(self, value: datatypes.ByteArrayType):
        value = datatypes.to_bytearray(value)
        self.setValue(value)

    def get_value(self) -> str:
        return self.value().data().decode()

    def set_expiration_date(self, date: datatypes.DateTimeType | None):
        date = datatypes.to_datetime(date)
        self.setExpirationDate(date)  # type: ignore