Merge "py3: Use StringIO from six" into f/centos8
This commit is contained in:
commit
6cb303be1a
@ -22,7 +22,7 @@ import six.moves.http_client
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import StringIO
|
from six import StringIO
|
||||||
from six.moves.urllib.parse import urlparse
|
from six.moves.urllib.parse import urlparse
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -166,9 +166,10 @@ class HTTPClient(object):
|
|||||||
# Read body into string if it isn't obviously image data
|
# Read body into string if it isn't obviously image data
|
||||||
body_str = None
|
body_str = None
|
||||||
if resp.getheader('content-type', None) != 'application/octet-stream':
|
if resp.getheader('content-type', None) != 'application/octet-stream':
|
||||||
body_str = ''.join([chunk for chunk in body_iter])
|
body_str = b''.join([chunk for chunk in body_iter])
|
||||||
|
body_str = body_str.decode("utf-8")
|
||||||
self.log_http_response(resp, body_str)
|
self.log_http_response(resp, body_str)
|
||||||
body_iter = StringIO.StringIO(body_str)
|
body_iter = StringIO(body_str)
|
||||||
else:
|
else:
|
||||||
self.log_http_response(resp)
|
self.log_http_response(resp)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user