def _process_response(self, res):
"""
Take the response object and return JSON
:param res:
:return:
"""
# TODO Figure out exceptions here
if res.headers['Content-Encoding'] == 'gzip':
self.send_log('Detected gzipped response', 'debug')
raw_output = gzip.decompress(res.read()).decode('utf-8')
else:
self.send_log('Detected other type of response encoding: {}'.format(res.headers['Content-Encoding']), 'debug')
raw_output = res.read().decode('utf-8')
json_output = json.loads(raw_output)
return json_output
deluge.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录