如何在python中执行此代码?

时间:2015-03-20 08:45:48

标签: python curl

curl https://api.smartsheet.com/1.1/sheet/7846568935090052 -H"授权:Bearer 4ziycpnqjvto49oah6t6urd4un" -H"接受:application / vnd.ms-excel" -o output.xls

1 个答案:

答案 0 :(得分:0)

使用subprocess模块:

subprocess.call('curl https://api.smartsheet.com/1.1/sheet/7846568935090052 -H "Authorization: Bearer 4ziycpnqjvto49oah6t6urd4un" -H "Accept: application/vnd.ms-excel" -o output.xls')

或者,您可以使用较旧的os.system()方式:

os.system('curl https://api.smartsheet.com/1.1/sheet/7846568935090052 -H "Authorization: Bearer 4ziycpnqjvto49oah6t6urd4un" -H "Accept: application/vnd.ms-excel" -o output.xls')