2007年01月30日 星期二 09:48
Hi All
import httplibconn = httplib.HTTPConnection("http://www.sugarcane.xmublog.com:80")conn.set_debuglevel(1)conn.putrequest('GET','/UploadFiles/2006-8/830935836.mp3',False,True)conn.putheader('Accept',"*/*")conn.putheader('Connection',"close")conn.endheaders()rMsg = conn.getresponse()这段代码总是返回HTTP 400错误 显示请求语法有问题,本人对http协议了解不深,望高手赐教,不胜感激
Best Regard and Thanks
-------------- 涓嬩竴閮ㄥ垎 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20070130/51d17fcd/attachment.htm
2007年01月30日 星期二 10:10
*class HTTPConnection*( host[, port])
An HTTPConnection instance represents one transaction with an HTTP
server. It should be instantiated passing it a host and optional
port number. If no port number is passed, the port is extracted from
the host string if it has the form |host:port|, else the default
HTTP port (80) is used. For example, the following calls all create
instances that connect to the server at the same host and port:
>>> h1 = httplib.HTTPConnection('www.cwi.nl')
>>> h2 = httplib.HTTPConnection('www.cwi.nl:80')
>>> h3 = httplib.HTTPConnection('www.cwi.nl', 80)
ÒÔÉÏΪPython ManualµÄÄÚÈÝ¡£Ó¦¸ÃHTTPConnectionºó²»ÓÃÔÚÊäÈëÐÒé'http://'Á˰ɡ£
wxt1984 дµÀ:
> Hi All
>
> import httplib
> conn = httplib.HTTPConnection("http://www.sugarcane.xmublog.com:80")
> conn.set_debuglevel(1)
> conn.putrequest('GET','/UploadFiles/2006-8/830935836.mp3',False,True)
> conn.putheader('Accept',"*/*")
> conn.putheader('Connection',"close")
> conn.endheaders()
> rMsg = conn.getresponse()
> Õâ¶Î´úÂë×ÜÊÇ·µ»ØHTTP 400´íÎó ÏÔʾÇëÇóÓï·¨ÓÐÎÊÌ⣬±¾È˶ÔhttpÐÒéÁ˽ⲻ
> ÉÍû¸ßÊִͽ̣¬²»Ê¤¸Ð¼¤
>
> Best Regard and Thanks
>
>
> ------------------------------------------------------------------------
> Å®ÓÑϲ»¶È¥µÄºÃµØ·½!ËùÓж«¶«ÍÂѪ¼Û µã»÷½øÈëÓдó¾ªÏ²!
> <http://adtaobao.allyes.com/main/adfclick?db=adtaobao&bid;=1319,1299,145&cid;=29985,198,1&sid;=45085&show;=ignore&url;=http://www.taobao.com/vertical/mall/pro.php>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
--
´ó¹Ü¼ÒÍøÉϽ¨²Ä³¬ÊÐ
×°ÐÞÂò½¨²Ä ÉÏÍøÕÒ´ó¹Ü¼Ò
http://www.homemaster.cn
Tel: 0086-21-34240987
Fax: 0086-21-64692422
Zeuux © 2025
京ICP备05028076号