Python encountered the problem of being unable to carry xml data when implementing put with requests library.

question: python uses the requests library to implement put get for http. There is no problem with get now. You need to carry the data of xml when using PUT. Now the debugging is not successful and the coding error is prompted. If you have no experience, please guide us.

import requests
from requests.auth import HTTPDigestAuth

fd = open ("defog.xml")
dataxml = fd.read ()

auth= HTTPDigestAuth ("admin"," 1111")
r = requests.put (url = cameraurl,data = dataxml, auth=auth)
print r.status_code

the contents of the defog.xml file are as follows:

< Defog >

<enbaled>false</enbaled>
<defogStrength>0</defogStrength>

< / Defog >

the error is as follows:
File "C:Python27libsite-packagesrequestsmodels.py", line 828, in content

self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""

File "C:Python27libsite-packagesrequestsmodels.py", line 753, in generate

raise ChunkedEncodingError(e)

requests.exceptions.ChunkedEncodingError: ("Connection broken: error (10054,")", error (10054,"")

Mar.04,2022

fd = open ('defog.xml') use open (path,encoding='UTF-8') when reading a file. Take a look at the encoding of the file first.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaf597-2247.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaf597-2247.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?