草庐IT

mimetools

全部标签

python - Python3 中的 mimetools.choose_boundary 函数在哪里?

我目前想在Python3中使用以下代码,但发现函数mimetools.choose_boundary已被弃用,如何更改代码并使其工作?importrefromurllib.requestimporturlopen,Requestimportosimportmimetypesimportmimetoolsdefget_content_type(filepath):returnmimetypes.guess_type(filepath)[0]or'application/octet-stream'defencode_multipart_formdata(fields,files=[]):"