urllib2看不到http debugging信息

Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

urllib2看不到http debugging信息

leopay

在Dive into python中的11.5. Setting the Userr-Agent
import httplib
>>> httplib.HTTPConnection.debuglevel = 1                            
>>> import urllib2
>>> request = urllib2.Request ('http://diveintomark.org/xml/atom.xml')
>>> opener = urllib2.build_opener()                                  
>>> feeddata = opener.open (request).read()                           
connect: (diveintomark.org, 80)
send: '
GET /xml/atom.xml HTTP/1.0
Host: diveintomark.org
User-agent: Python-urllib/2.1
'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Wed, 14 Apr 2004 23:23:12 GMT
header: Server: Apache/2.0.49 (Debian GNU/Linux)
header: Content-Type: application/atom+xml
header: Last-Modified: Wed, 14 Apr 2004 22:14:38 GMT
header: ETag: "e8284-68e0-4de30f80"
header: Accept-Ranges: bytes
header: Content-Length: 26848
header: Connection: close

并没有看到http debugging信息,这是怎么一回事?


_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: urllib2看不到http debugging信息

Bugzilla from xiaqqaix@gmail.com
在07-8-23,leopay <[hidden email]> 写道:

在Dive into python中的11.5. Setting the Userr-Agent
import httplib
>>> httplib.HTTPConnection.debuglevel = 1                            
>>> import urllib2
>>> request = urllib2.Request ('<a href="http://diveintomark.org/xml/atom.xml%27" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://diveintomark.org/xml/atom.xml')
>>> opener = urllib2.build_opener ()                                  
>>> feeddata = opener.open (request).read()                           
connect: (<a href="http://diveintomark.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">diveintomark.org, 80)
send: '
GET /xml/atom.xml HTTP/1.0
Host: <a href="http://diveintomark.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">diveintomark.org
User-agent: Python-urllib/2.1
'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Wed, 14 Apr 2004 23:23:12 GMT
header: Server: Apache/2.0.49 (Debian GNU/Linux)
header: Content-Type: application/atom+xml
header: Last-Modified: Wed, 14 Apr 2004 22:14:38 GMT
header: ETag: "e8284-68e0-4de30f80"
header: Accept-Ranges: bytes
header: Content-Length: 26848
header: Connection: close

并没有看到http debugging信息,这是怎么一回事?


我的机器上也有这个问题。本来我也想问的……

但不知道为何,在 ms$win 下成功了几次,后来就没有成功了;在ML(-_-?别想歪了,Magic Linux)下干脆就一次都没有成功,2.4 还是 2.5 都是如此

_______________________________________________
python-chinese
Post: send [hidden email]
Subscribe: send subscribe to [hidden email]
Unsubscribe: send unsubscribe to  [hidden email]
Detail Info: http://python.cn/mailman/listinfo/python-chinese
Reply | Threaded
Open this post in threaded view
|

Re: urllib2看不到http debugging信息

SwimmingB
This post has NOT been accepted by the mailing list yet.
You need to build the opener the following way
==========
opener = urllib2.build_opener(urllib2.HTTPHandler(debuglevel=1))
==========