network
Class info
Classes
| Name | Children | Inherits |
|---|---|---|
| AbstractSocket prettyqt.network.abstractsocket The base functionality common to all socket types. |
||
| AbstractSocketMixin prettyqt.network.abstractsocket |
||
| HostAddress prettyqt.network.hostaddress IP address. |
||
| HttpHeaders prettyqt.network.httpheaders Holds HTTP headers for network requests and replies. |
||
| HttpMultiPart prettyqt.network.httpmultipart Resembles a MIME multipart message to be sent over HTTP. |
||
| HttpPart prettyqt.network.httppart Holds a body part to be used inside a HTTP multipart MIME message. |
||
| LocalServer prettyqt.network.localserver Local socket based server. |
||
| LocalSocket prettyqt.network.localsocket Local socket. |
||
| NetworkAccessManager prettyqt.network.networkaccessmanager Allows the application to send network requests and receive replies. |
||
| NetworkAddressEntry prettyqt.network.networkaddressentry Stores one IP address supported by a network interface. |
||
| NetworkCookie prettyqt.network.networkcookie Holds one network cookie. |
||
| NetworkCookieJar prettyqt.network.networkcookiejar Implements a simple jar of QNetworkCookie objects. |
||
| NetworkDatagram prettyqt.network.networkdatagram The data and metadata of a UDP datagram. |
||
| NetworkInterface prettyqt.network.networkinterface Listing of the host's IP addresses and network interfaces. |
||
| NetworkProxy prettyqt.network.networkproxy Network layer proxy. |
||
| NetworkReply prettyqt.network.networkreply Contains the data and headers for a request sent with QNetworkAccessManager. |
||
| NetworkRequest prettyqt.network.networkrequest Holds a request to be sent with QNetworkAccessManager. |
||
| NetworkRequestFactory prettyqt.network.networkrequestfactory Convenience class for creating QNetworkRequest objects with shared settings. |
||
| RestAccessManager prettyqt.network.restaccessmanager Convenience wrapper around QNetworkAccessManager for RESTful APIs. |
||
| RestReply prettyqt.network.restreply Convenience wrapper around QNetworkReply for RESTful operations. |
||
| TcpServer prettyqt.network.tcpserver TCP-based server. |
||
| TcpSocket prettyqt.network.tcpsocket TCP Socket. |
||
| UdpSocket prettyqt.network.udpsocket UDP Socket. |
🛈 DocStrings
Classes to make network programming easier and more portable.
AbstractSocket
Bases: AbstractSocketMixin, QAbstractSocket
The base functionality common to all socket types.
Source code in prettyqt/network/abstractsocket.py
AbstractSocketMixin
Bases: IODeviceMixin, _AbstractSocketBase
Source code in prettyqt/network/abstractsocket.py
set_pause_mode(mode: PauseModeStr | mod.PauseMode)
Set pause mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
PauseModeStr | PauseMode
|
pause mode |
required |
HostAddress
Bases: QHostAddress
IP address.
Source code in prettyqt/network/hostaddress.py
HttpHeaders
Bases: QHttpHeaders
Holds HTTP headers for network requests and replies.
Source code in prettyqt/network/httpheaders.py
append_header(name: HeaderNameType, value: str) -> bool
from_dict(headers: Mapping[str, str]) -> Self
classmethod
Create an HttpHeaders instance from a mapping of header names to values.
Source code in prettyqt/network/httpheaders.py
get_combined_value(name: HeaderNameType) -> str
Return all values for the given header name combined with commas.
get_value(name: HeaderNameType, default: str = '') -> str
Return the first value for the given header name, or default if absent.
Source code in prettyqt/network/httpheaders.py
get_values(name: HeaderNameType) -> list[str]
remove_all(name: HeaderNameType)
replace_or_append(name: HeaderNameType, value: str) -> bool
Replace the first occurrence of name or append if not present.
to_dict() -> dict[str, str]
to_list() -> list[tuple[str, str]]
Return all headers as a list of (name, value) string pairs.
HttpMultiPart
Bases: ObjectMixin, QHttpMultiPart
Resembles a MIME multipart message to be sent over HTTP.
Source code in prettyqt/network/httpmultipart.py
set_content_type(typ: ContentTypeStr | QtNetwork.QHttpMultiPart.ContentType)
Set content type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
ContentTypeStr | ContentType
|
content type |
required |
HttpPart
Bases: QHttpPart
Holds a body part to be used inside a HTTP multipart MIME message.
Source code in prettyqt/network/httppart.py
LocalServer
Bases: ObjectMixin, QLocalServer
Local socket based server.
Source code in prettyqt/network/localserver.py
LocalSocket
Bases: IODeviceMixin, QLocalSocket
Local socket.
Source code in prettyqt/network/localsocket.py
NetworkAccessManager
Bases: ObjectMixin, QNetworkAccessManager
Allows the application to send network requests and receive replies.
Source code in prettyqt/network/networkaccessmanager.py
get_redirect_policy() -> network.networkrequest.RedirectPolicyStr
Get the current redirect policy.
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
NetworkAddressEntry
Bases: QNetworkAddressEntry
Stores one IP address supported by a network interface.
Source code in prettyqt/network/networkaddressentry.py
get_dns_eligibility() -> DnsEligibilityStatusStr
Return whether this address is eligible for publication in the DNS.
set_dns_eligibility(status: DnsEligibilityStatusStr | network.QNetworkAddressEntry.DnsEligibilityStatus)
Set the DNS eligibility flag for this address to status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
DnsEligibilityStatusStr | DnsEligibilityStatus
|
DNS eligibility status |
required |
Source code in prettyqt/network/networkaddressentry.py
NetworkCookie
Bases: QNetworkCookie
Holds one network cookie.
Source code in prettyqt/network/networkcookie.py
NetworkCookieJar
Bases: ObjectMixin, QNetworkCookieJar
Implements a simple jar of QNetworkCookie objects.
Source code in prettyqt/network/networkcookiejar.py
NetworkDatagram
Bases: QNetworkDatagram
The data and metadata of a UDP datagram.
Source code in prettyqt/network/networkdatagram.py
NetworkInterface
Bases: QNetworkInterface
Listing of the host's IP addresses and network interfaces.
Source code in prettyqt/network/networkinterface.py
NetworkProxy
Bases: QNetworkProxy
Network layer proxy.
Source code in prettyqt/network/networkproxy.py
get_type() -> ProxyTypeStr
set_type(typ: ProxyTypeStr | network.QNetworkProxy.ProxyType)
Set proxy type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typ
|
ProxyTypeStr | ProxyType
|
proxy type |
required |
NetworkReply
Contains the data and headers for a request sent with QNetworkAccessManager.
Source code in prettyqt/network/networkreply.py
NetworkRequest
Bases: QNetworkRequest
Holds a request to be sent with QNetworkAccessManager.
Source code in prettyqt/network/networkrequest.py
get_priority() -> PriorityStr
set_priority(priority: PriorityStr | Req.Priority)
Set priority.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
priority
|
PriorityStr | Priority
|
priority |
required |
NetworkRequestFactory
Bases: QNetworkRequestFactory
Convenience class for creating QNetworkRequest objects with shared settings.
Source code in prettyqt/network/networkrequestfactory.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
clear_attribute(attribute: network.networkrequest.AttributeStr | QtNetwork.QNetworkRequest.Attribute)
Clear the given attribute from this factory.
Source code in prettyqt/network/networkrequestfactory.py
create_request(path: str | None = None, query: core.QUrlQuery | None = None) -> network.NetworkRequest
Create a NetworkRequest from base URL, optional path, and optional query.
Source code in prettyqt/network/networkrequestfactory.py
get_attribute(attribute: network.networkrequest.AttributeStr | QtNetwork.QNetworkRequest.Attribute, default: Any = None) -> Any
Return the value of the given attribute, or default if not set.
Source code in prettyqt/network/networkrequestfactory.py
get_base_url() -> core.Url
get_bearer_token() -> str
get_common_headers() -> network.HttpHeaders
get_priority() -> network.networkrequest.PriorityStr
Return priority for requests created by this factory.
set_attribute(attribute: network.networkrequest.AttributeStr | QtNetwork.QNetworkRequest.Attribute, value: datatypes.Variant)
Set an attribute common to all requests created by this factory.
Source code in prettyqt/network/networkrequestfactory.py
set_base_url(url: datatypes.UrlType)
set_bearer_token(token: datatypes.ByteArrayType)
set_common_headers(headers: QtNetwork.QHttpHeaders | Mapping[str, str])
Set headers common to all requests created by this factory.
Source code in prettyqt/network/networkrequestfactory.py
set_priority(priority: network.networkrequest.PriorityStr | QtNetwork.QNetworkRequest.Priority)
Set priority for requests created by this factory.
Source code in prettyqt/network/networkrequestfactory.py
RestAccessManager
Bases: ObjectMixin, QRestAccessManager
Convenience wrapper around QNetworkAccessManager for RESTful APIs.
Source code in prettyqt/network/restaccessmanager.py
get_network_access_manager() -> network.NetworkAccessManager
RestReply
Bases: QRestReply
Convenience wrapper around QNetworkReply for RESTful operations.
Source code in prettyqt/network/restreply.py
get_error() -> network.networkreply.NetworkErrorStr
get_http_status() -> int
get_network_reply() -> network.NetworkReply | None
Return the underlying NetworkReply, or None if unset.
is_http_status_success() -> bool
is_success() -> bool
read_body() -> bytes
read_json() -> Any
Read and parse the received JSON data into Python objects, or None.
Source code in prettyqt/network/restreply.py
TcpServer
Bases: ObjectMixin, QTcpServer
TCP-based server.
Source code in prettyqt/network/tcpserver.py
TcpSocket
UdpSocket
Bases: AbstractSocketMixin, QUdpSocket
UDP Socket.