2006年11月27日 星期一 10:44
不好意思用这个名字吸引眼球. 问题是这样的:我现在的网络环境必须通过代理上网,但是用urllib模块的urlopen方法无效,请问如何解决? 我的用法是: import urllib proxies={'http':'http://192.168.0.1:808'} sock=urllib.urlopen('http://www.sina.com.cn',proxies=proxies) html=sock.read() sock.close() print html 返回以下错误:
2006年11月27日 星期一 10:47
> While trying to process the request:
>
> GET HTTP/1.0
> Host: www.sina.com.cn
> User-Agent: Python-urllib/1.17
>
>
>
>
> The following error was encountered:
>
>
> Some aspect of the HTTP Request is invalid. Possible problems:
>
>
Your cache administrator is webmaster.
>
>
>
>
> Generated Mon, 27 Nov 2006 02:42:08 GMT by xa66-64.sina.com.cn
> (CachePower/1.3.1.dev)
>
>
>
>
> 而我能在邮件列表上发帖就证明我的代理是没问题的,还请高手们帮忙看看.
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
--
Any complex technology which doesn't come with documentation must be the best
available.
2006年11月27日 星期一 13:06
2006/11/27, tdus lost <tdus.lost在gmail.com>: > > ²»ºÃÒâ˼ÓÃÕâ¸öÃû×ÖÎüÒýÑÛÇò. > > ÎÊÌâÊÇÕâÑùµÄ:ÎÒÏÖÔÚµÄÍøÂç»·¾³±ØÐëͨ¹ý´úÀíÉÏÍø,µ«ÊÇÓÃurllibÄ£¿éµÄurlopen·½·¨ÎÞЧ,ÇëÎÊÈçºÎ½â¾ö? ºÃ×Å°¡£¬ÎÒÕâÀïÒ²ÒªÓôúÀí£¬ÎÒÓÃÄãÕâ¸ö·½·¨£¬¿ÉÒÔ°ÑGOOGLEµÄÊ×Ò³´ò¿ª£¡ÎÒ°ÑËüдÈëµ½Îļþ£¬´ò¿ªÊ±Ò²ºÜÕý³£°¡£¡ ÎÒµÄÓ÷¨ÊÇ: > import urllib > proxies={'http':'http://192.168.0.1:808'} »³ÒÉÄãÕâ¸ö¶Ë¿Úд´íÁË£¬ÊDz»ÊÇ8080µÄ¡£ sock=urllib.urlopen('http://www.sina.com.cn',proxies=proxies) > html=sock.read() > sock.close() > print html > > ·µ»ØÒÔÏ´íÎó: > > "http://www.w3.org/TR/html4/loose.dtd"> > >>ERROR: The requested URL could not be retrieved > > >ERROR
>The requested URL could not be retrieved
>
>> While trying to process the request: >
> GET HTTP/1.0 > Host: www.sina.com.cn > User-Agent: Python-urllib/1.17 > > >
> The following error was encountered:
>
>
> Some aspect of the HTTP Request is invalid. Possible problems:
>
>
Your cache administrator is webmaster.
>
>
>
>
> Generated Mon, 27 Nov 2006 02:42:08 GMT by xa66-64.sina.com.cn
> (CachePower/1.3.1.dev)
>
>
>
>
> ¶øÎÒÄÜÔÚÓʼþÁбíÉÏ·¢Ìû¾ÍÖ¤Ã÷ÎҵĴúÀíÊÇûÎÊÌâµÄ,»¹Çë¸ßÊÖÃÇ°ïæ¿´¿´.
>
_______________________________________________
> 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
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20061127/34076380/attachment-0001.html
[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]
Zeuux © 2025
京ICP备05028076号