PySide6.QtNetwork.QFormDataPartBuilder¶
- class QFormDataPartBuilder¶
- The - QFormDataPartBuilderclass is a convenience class to simplify the construction of- QHttpPartobjects. More…- Added in version 6.8. - Synopsis¶- Methods¶- def - __init__()
- def - setBody()
- def - setBodyDevice()
- def - setHeaders()
- def - swap()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- The - QFormDataPartBuilderclass can be used to build a- QHttpPartobject with the content disposition header set to be form-data by default. Then the generated object can be used as part of a multipart message (which is represented by the- QHttpMultiPartclass).- See also - __init__()¶
 - setBody(data[, fileName={}[, mimeType={}]])¶
- Parameters:
- data – - QByteArrayView
- fileName – str 
- mimeType – str 
 
- Return type:
 
 - Sets - dataas the body of this MIME part and, if given,- fileNameas the file name parameter in the content disposition header.- If - mimeTypeis not given (is empty), then- QFormDataPartBuildertries to auto-detect the mime-type of- datausing QMimeDatabase.- A subsequent call to - setBodyDevice()discards the body and the device will be used instead.- For a large amount of data (e.g. an image), - setBodyDevice()is preferred, which will not copy the data internally.- See also - setBodyDevice(body[, fileName={}[, mimeType={}]])¶
- Parameters:
- body – - QIODevice
- fileName – str 
- mimeType – str 
 
- Return type:
 
 - Sets - bodyas the body device of this part and- fileNameas the file name parameter in the content disposition header.- If - mimeTypeis not given (is empty), then- QFormDataPartBuildertries to auto-detect the mime-type of- bodyusing QMimeDatabase.- A subsequent call to - setBody()discards the body device and the data set by- setBody()will be used instead.- For large amounts of data this method should be preferred over - setBody(), because the content is not copied when using this method, but read directly from the device.- bodymust be open and readable.- QFormDataPartBuilderdoes not take ownership of- body, i.e. the device must be closed and destroyed if necessary.- Note - If - bodyis sequential (e.g. sockets, but not files),- post()should be called after- bodyhas emitted finished().- See also - setHeaders(headers)¶
- Parameters:
- headers – - QHttpHeaders
- Return type:
 
 - Sets the headers specified in - headers.- Note - The “content-type” and “content-disposition” headers, if any are specified in - headers, will be overwritten by the class.- swap(other)¶
- Parameters:
- other – - QFormDataPartBuilder