问题:python使用requests库实现 http的put get。get现在没有问题,使用PUT时 需要携带xml的数据,现在没有调试成功,提示编码错误,这块没有经验 请大神指导。import requestsfrom requests.auth import HTTPDigestAuthfd = open('defog.xml')dataxml = fd.read()auth = HTTPDigestAuth('admin', '1111')r = requests.put(url = cameraurl,data = dataxml, auth=auth)print r.status_codedefog.xml 文件的内容如下:<Defog> <enbaled>false</enbaled> <defogStrength>0</defogStrength></Defog>报错如下: 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, ''))
添加回答
举报
0/150
提交
取消