Fix #1959
This commit is contained in:
@@ -20,11 +20,12 @@ __version__ = "0.05"
|
|||||||
import sys
|
import sys
|
||||||
PY2 = sys.version_info[0] == 2
|
PY2 = sys.version_info[0] == 2
|
||||||
|
|
||||||
import urllib
|
|
||||||
if PY2:
|
if PY2:
|
||||||
|
import urllib
|
||||||
from xmlrpclib import Transport, SafeTransport
|
from xmlrpclib import Transport, SafeTransport
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
else:
|
else:
|
||||||
|
import urllib.request as urllib
|
||||||
from xmlrpc.client import Transport, SafeTransport
|
from xmlrpc.client import Transport, SafeTransport
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import random
|
import random
|
||||||
@@ -47,7 +48,7 @@ class JSONDummyParser:
|
|||||||
self.buf = StringIO()
|
self.buf = StringIO()
|
||||||
|
|
||||||
def feed(self, data):
|
def feed(self, data):
|
||||||
self.buf.write(data)
|
self.buf.write(data.decode('utf-8'))
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
return self.buf.getvalue()
|
return self.buf.getvalue()
|
||||||
@@ -61,7 +62,7 @@ class JSONTransportMixin:
|
|||||||
connection.putheader("Content-Length", str(len(request_body)))
|
connection.putheader("Content-Length", str(len(request_body)))
|
||||||
connection.endheaders()
|
connection.endheaders()
|
||||||
if request_body:
|
if request_body:
|
||||||
connection.send(request_body)
|
connection.send(str.encode(request_body))
|
||||||
# todo: add gzip compression
|
# todo: add gzip compression
|
||||||
|
|
||||||
def getparser(self):
|
def getparser(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user