Skip to content

HttpMultiPart

Base classes

Name Children Inherits
ObjectMixin
prettyqt.core.object
QHttpMultiPart
PySide6.QtNetwork
QHttpMultiPart(self, contentType: PySide6.QtNetwork.QHttpMultiPart.ContentType, /, parent: PySide6.QtCore.QObject | None \= None) -> None

⋔ Inheritance diagram

graph TD
  3692364005["network.HttpMultiPart"]
  3227531497["core.ObjectMixin"]
  2751680898["builtins.object"]
  2725803902["QtNetwork.QHttpMultiPart"]
  3984060476["QtCore.QObject"]
  37984305["Shiboken.Object"]
  3227531497 --> 3692364005
  2751680898 --> 3227531497
  2725803902 --> 3692364005
  3984060476 --> 2725803902
  37984305 --> 3984060476
  2751680898 --> 37984305

🛈 DocStrings

Bases: ObjectMixin, QHttpMultiPart

Resembles a MIME multipart message to be sent over HTTP.

Source code in prettyqt/network/httpmultipart.py
class HttpMultiPart(core.ObjectMixin, QtNetwork.QHttpMultiPart):
    """Resembles a MIME multipart message to be sent over HTTP."""

    def __add__(self, other: QtNetwork.QHttpPart):
        self.append(other)
        return self

    def set_content_type(
        self, typ: ContentTypeStr | QtNetwork.QHttpMultiPart.ContentType
    ):
        """Set content type.

        Args:
            typ: content type
        """
        self.setContentType(CONTENT_TYPES.get_enum_value(typ))

    def set_boundary(self, boundary: datatypes.ByteArrayType):
        boundary = datatypes.to_bytearray(boundary)
        self.setBoundary(boundary)

    def get_boundary(self) -> str:
        return bytes(self.boundary().data()).decode()

set_content_type(typ: ContentTypeStr | QtNetwork.QHttpMultiPart.ContentType)

Set content type.

Parameters:

Name Type Description Default
typ ContentTypeStr | ContentType

content type

required
Source code in prettyqt/network/httpmultipart.py
def set_content_type(
    self, typ: ContentTypeStr | QtNetwork.QHttpMultiPart.ContentType
):
    """Set content type.

    Args:
        typ: content type
    """
    self.setContentType(CONTENT_TYPES.get_enum_value(typ))

:fa-brands-github: Show source on GitHub