From d20bddfb49b25808c93ba53f9c02d1aa329eff54 Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Sat, 7 Sep 2019 08:01:56 -0400 Subject: [PATCH] fix byte strings for Blinka compatibility --- adafruit_requests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_requests.py b/adafruit_requests.py index 4874563..21991f9 100755 --- a/adafruit_requests.py +++ b/adafruit_requests.py @@ -192,9 +192,9 @@ def request(method, url, data=None, json=None, headers=None, stream=False, timeo else: conntype = _the_interface.TCP_MODE sock.connect(addr_info[-1], conntype) - sock.send(b"%s /%s HTTP/1.0\r\n" % (method, path)) + sock.send(b"%s /%s HTTP/1.0\r\n" % (bytes(method, "utf-8"), bytes(path, "utf-8"))) if "Host" not in headers: - sock.send(b"Host: %s\r\n" % host) + sock.send(b"Host: %s\r\n" % bytes(host, "utf-8")) if "User-Agent" not in headers: sock.send(b"User-Agent: Adafruit CircuitPython\r\n") # Iterate over keys to avoid tuple alloc