From a44822acf596aab641f66909bdb432bebb1db39a Mon Sep 17 00:00:00 2001 From: Brice Boucard Date: Thu, 12 Nov 2020 23:02:58 +0100 Subject: [PATCH] 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 --- bin/user/netatmo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/user/netatmo.py b/bin/user/netatmo.py index 2f4a512..6cdca34 100644 --- a/bin/user/netatmo.py +++ b/bin/user/netatmo.py @@ -518,7 +518,7 @@ class CloudClient(Collector): def post_request(url, params): # netatmo response body size is limited to 64K url = CloudClient.NETATMO_URL + url - params = urlencode(params) + params = urlencode(params).encode("utf-8") headers = { "Content-Type": "application/x-www-form-urlencoded;charset=utf-8"} logdbg("url: %s data: %s hdr: %s" % (url, params, headers))