gizp data is bytes

This commit is contained in:
j 2014-10-31 15:47:54 +01:00
parent a306370f0d
commit 5cd43be8c4

View file

@ -6,7 +6,7 @@ from queue import Queue
from threading import Thread from threading import Thread
import json import json
import socket import socket
from io import StringIO from io import BytesIO
import gzip import gzip
import urllib.request, urllib.error, urllib.parse import urllib.request, urllib.error, urllib.parse
from datetime import datetime from datetime import datetime
@ -164,7 +164,7 @@ class Node(Thread):
data = r.read() data = r.read()
logger.debug('response data: %s', data) logger.debug('response data: %s', data)
if r.headers.get('content-encoding', None) == 'gzip': if r.headers.get('content-encoding', None) == 'gzip':
data = gzip.GzipFile(fileobj=StringIO(data)).read() data = gzip.GzipFile(fileobj=BytesIO(data)).read()
version = r.headers.get('X-Node-Protocol', None) version = r.headers.get('X-Node-Protocol', None)
if version != settings.NODE_PROTOCOL: if version != settings.NODE_PROTOCOL: