【发布时间】:2017-12-27 15:03:29
【问题描述】:
谁能告诉我如何将下面的 CURL 命令转换为 Python3 请求模块?
卷曲命令 :
curl --header "Accept=application/json" --form
print_file=@a.gcode http://189.167.1.103/print_file_uploads
其实我要上传一个Gcode文件到3D打印机。
我成功使用了模块 OS。我就是这样做的。
成功 :
import os
ip_address = 189.167.1.103
file_name = "D:\networking\a.gcode"
os.system("curl --header "Accept=application/json" --form
print_file=@%shttp://%s/print_file_uploads"%(file_name,ip_address))
但我不希望它与操作系统模块一起完成。你能帮我在 python3 请求中实现同样的功能吗?
【问题讨论】:
-
请详细描述初始 curl 命令的作用,我相信有人会很乐意帮助您
标签: python-3.x python-2.7 curl python-requests