Stick to Unicode when possible.
This commit is contained in:
parent
ef36e0e02a
commit
9137da5483
|
@ -53,14 +53,11 @@ def check_location(options, where):
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
print(format_http_error("ERROR", resp), file=stderr)
|
print(format_http_error("ERROR", resp), file=stderr)
|
||||||
return 1
|
return 1
|
||||||
jdata = resp.read()
|
jdata = resp.read().decode()
|
||||||
|
|
||||||
if options.get("raw"):
|
if options.get("raw"):
|
||||||
if PY3:
|
stdout.write(jdata)
|
||||||
stdoutb = stdout.buffer
|
stdout.write("\n")
|
||||||
else:
|
|
||||||
stdoutb = stdout
|
|
||||||
stdoutb.write(jdata)
|
|
||||||
stdoutb.write(b"\n")
|
|
||||||
return 0
|
return 0
|
||||||
data = json.loads(jdata)
|
data = json.loads(jdata)
|
||||||
|
|
||||||
|
@ -323,17 +320,12 @@ class DeepCheckStreamer(LineOnlyReceiver, object):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# use Twisted to split this into lines
|
# use Twisted to split this into lines
|
||||||
if PY3:
|
|
||||||
stdoutb = stdout.buffer
|
|
||||||
else:
|
|
||||||
stdoutb = stdout
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
chunk = resp.read(100)
|
chunk = resp.read(100)
|
||||||
if not chunk:
|
if not chunk:
|
||||||
break
|
break
|
||||||
if self.options["raw"]:
|
if self.options["raw"]:
|
||||||
stdoutb.write(chunk)
|
stdout.write(chunk.decode())
|
||||||
else:
|
else:
|
||||||
output.dataReceived(chunk)
|
output.dataReceived(chunk)
|
||||||
if not self.options["raw"]:
|
if not self.options["raw"]:
|
||||||
|
|
Loading…
Reference in New Issue