谢谢指导。请问一下,MSXML的手册在什么地方有,我要仔细看看说明。
我的系统是Windows XP SP2,打齐了补丁,所以MSXML组件有安装升级,但是在本机搜索了一下,没有相关的帮助。
谢谢!
junyi sun 写道:
如果你是windows平台,通过python调COM好了,连Cookie都不用自己管理,行为和IE一模一样。
而且Connection: Keep-Alive
代码大概像这样的:
http = win32com.client.Dispatch("msxml2.xmlhttp")
http.Open("POST",url,False)
http.send(q)
2008/2/27 hechu <
hcpython@...>:
这个问题去年有人讨论过,我也
是搜索去年的邮件搜出来的相关信息。
我安装的是python2.5,在 urllib2.py 文件的第 1068 行。
也就是 AbstractHTTPHandler 这个类的 do_open 方法中。
注释说,addinfourl 类对持久链接没准备好。。。
代码片段如下:
# We want to make an HTTP/1.1 request, but the
addinfourl
# class isn't prepared to deal with a persistent connection.
# It will try to read all remaining data from the socket,
# which will block while the server waits for the next request.
# So make sure the connection gets closed after the (only)
# request.
headers["Connection"] = "close"
headers = dict(
(name.title(), val) for name, val in headers.items())
try:
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
|
fluke.l 写道:
urllib2
中是什么地方的硬编码导致和keep-alive不兼容?
--~--~---------~--~----~------------~-------~--~----~
'''邮件来自Groups "python-cn"--China Py User Group
详情: http://groups-beta.google.com/group/python-cn
发言:
python-cn@...
退订:
python-cn-unsubscribe@...
维基: http://wiki.woodpecker.org.cn/moin/CPUG
珠江事务: http://groups.google.com/group/zpug
东南事务: http://groups.google.com/group/cpug-eastchina
北京事务: http://groups.google.com/group/bpug
中国事务: http://groups.google.com/group/CPUG
同质列表: http://python.cn/mailman/listinfo/python-chinese
'''
-~----------~----~----~----~------~----~------~--~---