1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-10 06:16:46 +00:00

Force proper encoding before handling XML.

This commit is contained in:
Markus Birth 2017-11-03 11:46:31 +01:00
parent 0446ac89e5
commit 697e332eb8

View File

@ -175,6 +175,7 @@ class FotaCheck:
last_response = req last_response = req
if req.status_code == 200: if req.status_code == 200:
self.master_server_vote_on_time(reqtime, reqtime_avg) self.master_server_vote_on_time(reqtime, reqtime_avg)
req.encoding = "utf-8" # Force encoding as server doesn't give one
self.write_dump(req.text) self.write_dump(req.text)
return req.text return req.text
elif req.status_code == 204: elif req.status_code == 204:
@ -282,6 +283,7 @@ class FotaCheck:
#print(repr(dict(params))) #print(repr(dict(params)))
req = self.sess.post(url, data=params) req = self.sess.post(url, data=params)
if req.status_code == 200: if req.status_code == 200:
req.encoding = "utf-8" # Force encoding as server doesn't give one
self.write_dump(req.text) self.write_dump(req.text)
return req.text return req.text
else: else: