使用http.client调试时如何格式化输出?

时间:2012-05-28 10:39:57

标签: debugging python-3.x

这是我的代码:

#coding=UTF-8
import urllib3
import http.client

http.client.HTTPConnection.debuglevel = 1

API_URL = 'http://www.nyaa.eu/'

http_pool = urllib3.connection_from_url(API_URL)
r = http_pool.request('GET',API_URL)
print (r.status)

输出如下:

send: b'GET http://www.nyaa.eu/ HTTP/1.1\r\nHost: www.nyaa.eu\r\nAccept-Encoding: identity\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Server header: Date header: Content-Type header: Transfer-Encoding header: Connection header: Vary 200

输出不包含\n。 阅读很难。 有没有办法格式化输出?

0 个答案:

没有答案
相关问题