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,"")