NetworkRequest
Qt Base Class: QNetworkRequest
Signature: QNetworkRequest(self) -> None
QNetworkRequest(self, other: PySide6.QtNetwork.QNetworkRequest) -> None
QNetworkRequest(self, url: Union[PySide6.QtCore.QUrl, str]) -> None
Base classes
Name |
Children |
Inherits |
QNetworkRequest PySide6.QtNetwork QNetworkRequest(self) -> None |
|
|
⋔ Inheritance diagram
graph TD
1473573999760["network.NetworkRequest"]
1473573267728["QtNetwork.QNetworkRequest"]
1473291690208["Shiboken.Object"]
140713234304496["builtins.object"]
1473573267728 --> 1473573999760
1473291690208 --> 1473573267728
140713234304496 --> 1473291690208
🛈 DocStrings
Bases: QNetworkRequest
Holds a request to be sent with QNetworkAccessManager.
Source code in prettyqt\network\networkrequest.py
| class NetworkRequest(QtNetwork.QNetworkRequest):
"""Holds a request to be sent with QNetworkAccessManager."""
def __init__(self, obj: datatypes.UrlType | QtNetwork.QNetworkRequest | None = None):
if isinstance(obj, QtNetwork.QNetworkRequest):
super().__init__(obj)
else:
super().__init__()
if obj is not None:
self.set_url(obj)
def __repr__(self):
return get_repr(self, self.get_url())
def set_header(self, name: KnownHeaderStr | Req.KnownHeaders, value: str):
self.setHeader(KNOWN_HEADER.get_enum_value(name), value)
def get_header(self, name: KnownHeaderStr | Req.KnownHeaders) -> str:
return self.header(KNOWN_HEADER.get_enum_value(name))
def set_headers(self, headers: Mapping[str, str]):
for k, v in headers.items():
self.setRawHeader(core.QByteArray(k.encode()), core.QByteArray(v.encode()))
def get_headers(self) -> Mapping[str, str]:
return {
h.data().decode(): self.rawHeader(h).data().decode()
for h in self.rawHeaderList()
}
def set_url(self, url: str | core.QUrl):
url = core.Url(url)
self.setUrl(url)
def get_url(self) -> core.Url:
return core.Url(self.url())
def set_priority(self, priority: PriorityStr | Req.Priority):
"""Set priority.
Args:
priority: priority
"""
self.setPriority(PRIORITY.get_enum_value(priority))
def get_priority(self) -> PriorityStr:
"""Get the current priority.
Returns:
priority
"""
return PRIORITY.inverse[self.priority()]
def set_attribute(
self, attribute: AttributeStr | Req.Attribute, value: datatypes.Variant
):
self.setAttribute(ATTRIBUTE.get_enum_value(attribute), value)
def set_attributes(self, **kwargs):
for k, v in kwargs.items():
self.set_attribute(k, v)
|
get_priority() -> PriorityStr
Get the current priority.
Source code in prettyqt\network\networkrequest.py
| def get_priority(self) -> PriorityStr:
"""Get the current priority.
Returns:
priority
"""
return PRIORITY.inverse[self.priority()]
|
set_priority(priority: PriorityStr | Req.Priority)
Set priority.
Parameters:
Name |
Type |
Description |
Default |
priority |
PriorityStr | Priority
|
|
required
|
Source code in prettyqt\network\networkrequest.py
| def set_priority(self, priority: PriorityStr | Req.Priority):
"""Set priority.
Args:
priority: priority
"""
self.setPriority(PRIORITY.get_enum_value(priority))
|