Skip to content

Commit 2374770

Browse files
committed
uurequests: Improve compatibility with CPython
"method", "path" and "host" are all variables of regular string type, which doesn't interpolate well into bytestrings. This change will resolve pfalcon#49.
1 parent 79c17d4 commit 2374770

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

uurequests/uurequests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def request(method, url, data=None, json=None, headers={}, stream=None, parse_he
6464
s.connect(ai[-1])
6565
if proto == "https:":
6666
s = ussl.wrap_socket(s, server_hostname=host)
67-
s.write(b"%s /%s HTTP/1.0\r\n" % (method, path))
67+
s.write(b"%s /%s HTTP/1.0\r\n" % (method.encode(), path.encode()))
6868
if not "Host" in headers:
69-
s.write(b"Host: %s\r\n" % host)
69+
s.write(b"Host: %s\r\n" % host.encode())
7070
# Iterate over keys to avoid tuple alloc
7171
for k in headers:
7272
s.write(k)

0 commit comments

Comments
 (0)