Makes this request field into a multipart request field. This method overrides "Content-Disposition", "Content-Type" and "Content-Location" headers to the request parameter. :param content_disposition: The 'Content-Disposition' of the request body. Defa
(
self,
content_disposition: str | None = None,
content_type: str | None = None,
content_location: str | None = None,
)
| 308 | return "\r\n".join(lines) |
| 309 | |
| 310 | def make_multipart( |
| 311 | self, |
| 312 | content_disposition: str | None = None, |
| 313 | content_type: str | None = None, |
| 314 | content_location: str | None = None, |
| 315 | ) -> None: |
| 316 | """ |
| 317 | Makes this request field into a multipart request field. |
| 318 | |
| 319 | This method overrides "Content-Disposition", "Content-Type" and |
| 320 | "Content-Location" headers to the request parameter. |
| 321 | |
| 322 | :param content_disposition: |
| 323 | The 'Content-Disposition' of the request body. Defaults to 'form-data' |
| 324 | :param content_type: |
| 325 | The 'Content-Type' of the request body. |
| 326 | :param content_location: |
| 327 | The 'Content-Location' of the request body. |
| 328 | |
| 329 | """ |
| 330 | content_disposition = (content_disposition or "form-data") + "; ".join( |
| 331 | [ |
| 332 | "", |
| 333 | self._render_parts( |
| 334 | (("name", self._name), ("filename", self._filename)) |
| 335 | ), |
| 336 | ] |
| 337 | ) |
| 338 | |
| 339 | self.headers["Content-Disposition"] = content_disposition |
| 340 | self.headers["Content-Type"] = content_type |
| 341 | self.headers["Content-Location"] = content_location |