Solve the "POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str." issue thanks to https://github.com/matthewwall/weewx-netatmo/issues/15#issuecomment-628994957

master
Brice Boucard 4 years ago
parent 005b6ee943
commit a44822acf5

@ -518,7 +518,7 @@ class CloudClient(Collector):
def post_request(url, params): def post_request(url, params):
# netatmo response body size is limited to 64K # netatmo response body size is limited to 64K
url = CloudClient.NETATMO_URL + url url = CloudClient.NETATMO_URL + url
params = urlencode(params) params = urlencode(params).encode("utf-8")
headers = { headers = {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"} "Content-Type": "application/x-www-form-urlencoded;charset=utf-8"}
logdbg("url: %s data: %s hdr: %s" % (url, params, headers)) logdbg("url: %s data: %s hdr: %s" % (url, params, headers))

Loading…
Cancel
Save