Upload a large XML file with Python Requests library

前端 未结 3 863
猫巷女王i
猫巷女王i 2021-02-10 02:44

I\'m trying to replace curl with Python & the requests library. With curl, I can upload a single XML file to a REST server with the curl -T option. I have been unable to do

3条回答
  •  深忆病人
    2021-02-10 03:17

    i used requests in python to upload an XML file using the commands. first to open the file use open() file = open("PIR.xsd") fragment = file.read() file.close() copy the data of XML file in the payload of the requests and post it payload = {'key':'PFAkrzjmuZR957','xmlFragment':fragment} r = requests.post(URL,data=payload) to check the html validation code print (r.text)

提交回复
热议问题