0
我試圖發出從Python中的curl命令,從命令行它工作正常:無法解析主機:>
curl -k --data-binary @GetRequestData.xml -u archala:[email protected] https://wsgwtestmg.mass.gov:5550/service/mgmt/current > Response\generated_Resp.xml
但是當我從蟒蛇把它叫做:
from sys import argv
import subprocess
# run python cache2.py hosts.txt Test
with open(argv[1]) as f:
addresses = {i.split(" : ")[0] : i.split(" : ")[1] for i in f}
print(addresses[argv[2]])
command = "curl -k --data-binary @GetRequestData.xml -u archala:[email protected] https://" +addresses[argv[2]].strip()+ ":5550/service/mgmt/current > Response\generated_Resp.xml"
print(command)
p = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()[0]
我得到: 無法解析主機:>
'print(command)'的輸出是什麼? –
你認爲你在代碼中設置了「https:// wsgwtestmg.mass.gov」在哪裏? –
https://wsgwtestmg.mass.gov來自地址[argv [2]] –