flyonok

统计

留言簿(7)

ACE

book

boost

bsd

c study

c++

code download

codeblock

computer clound

Eclipse

embed system

erlang

ET++

gtk

ic card

java

KDE

libevent

linux

linux--MM

mysql

network education

one card

oracle

pcap relation

php

powerbuilder

python

QT

software config

software test

SQL server

UML

wireless

wxwidgets

陈宾

阅读排行榜

评论排行榜

python中urllib和urllib2不同的调试方法

使用urllib发http请求时:
 

import urllib, httplib 
httplib.HTTPConnection.debuglevel = 1 
urllib.urlopen(
http://google.com)

 
 
使用urllib2发http请求时:
 

import urllib2 
handler=urllib2.HTTPHandler(debuglevel=1) 
opener = urllib2.build_opener(handler) 
urllib2.install_opener(opener) 
request = urllib2.Request(url,headers,data)

 
 
debuglevel设置微1可以查看header、body等内容

posted on 2010-12-16 17:39 flyonok 阅读(751) 评论(0)  编辑 收藏 引用 所属分类: python


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理