Skip to content

HttpPart

Qt Base Class: QHttpPart

Signature: QHttpPart(self) -> None QHttpPart(self, other: PySide6.QtNetwork.QHttpPart) -> None

Base classes

Name Children Inherits
QHttpPart
PySide6.QtNetwork
QHttpPart(self) -> None

⋔ Inheritance diagram

graph TD
  1473574007568["network.HttpPart"]
  1473573769424["QtNetwork.QHttpPart"]
  1473291690208["Shiboken.Object"]
  140713234304496["builtins.object"]
  1473573769424 --> 1473574007568
  1473291690208 --> 1473573769424
  140713234304496 --> 1473291690208

🛈 DocStrings

Bases: QHttpPart

Holds a body part to be used inside a HTTP multipart MIME message.

Source code in prettyqt\network\httppart.py
class HttpPart(network.QHttpPart):
    """Holds a body part to be used inside a HTTP multipart MIME message."""

    def set_body(self, body: datatypes.ByteArrayType):
        body = datatypes.to_bytearray(body)
        self.setBody(body)

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

    def set_header(self, name: str, value: network.networkrequest.KnownHeaderStr):
        self.setHeader(network.networkrequest.KNOWN_HEADER[name], value)