I'm trying to form a cURL using string concatenation in Python. I have a custom command and I'm not sure if I can use requests for this.
cmd='curl -u admin:'+password+' -F file=@'+package+' -F name='+package+' -F force=false -F install=true http://'+ip+':5101/crx/packmgr/service.jsp'
print(cmd)
Error:
curl -u admin:******** -F file=@abc_xyz.zip
-F name=abc_xyz.zip
-F force=false -F install=true http://8.8.8.8:5101/crx/packmgr/service.jsp
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
sh: line 1: -F: command not found
sh: line 2: -F: command not found
32512
And yes I have tried escape '' as well. Didn't work.
Any help would be greatly appreciated. TIA
passwordvariable? Trypassword = password.strip()before construncting the command. Or, more likely inpackagevariable?password = password.strip()did not work.package = package.strip()