2007年10月17日 星期三 21:15
urllilb2有很多class,好难看懂,例子也莫名其妙。那位大虾有用urllib2通过proxy上网的例子。 add_password( realm, uri, user, passwd) 中realm,uri 是什么含意???怎样配制??? 谢谢大虾们:)
2007年10月17日 星期三 21:19
http://www.voidspace.org.uk/python/articles/urllib2.shtml ¿ÉÒÔ¿´¿´Õâ¸ö On 10/17/07, OnMyWay <onmyway.q在gmail.com> wrote: > > urllilb2Óкܶàclass£¬ºÃÄÑ¿´¶®£¬Àý×ÓҲĪÃûÆäÃî¡£ÄÇλ´óϺÓÐÓÃurllib2ͨ¹ýproxyÉÏÍøµÄÀý×Ó¡£ > > add_password( realm, uri, user, passwd) > ÖÐrealm£¬uri ÊÇʲôº¬Ò⣿£¿£¿ÔõÑùÅäÖÆ£¿£¿£¿ > > лл´óϺÃÇ£º£© > _______________________________________________ > 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/20071017/96ef27a2/attachment.htm
2007年10月17日 星期三 22:33
proxy ´úÀí?? urllib2ĬÈϵ÷ÓÃie´úÀí ÔÚ07-10-17£¬@@ <askfor在gmail.com> дµÀ£º > > http://www.voidspace.org.uk/python/articles/urllib2.shtml > > ¿ÉÒÔ¿´¿´Õâ¸ö > > > On 10/17/07, OnMyWay <onmyway.q在gmail.com> wrote: > > > > urllilb2Óкܶàclass£¬ºÃÄÑ¿´¶®£¬Àý×ÓҲĪÃûÆäÃî¡£ÄÇλ´óϺÓÐÓÃurllib2ͨ¹ýproxyÉÏÍøµÄÀý×Ó¡£ > > > > add_password( realm, uri, user, passwd) > > ÖÐrealm£¬uri ÊÇʲôº¬Ò⣿£¿£¿ÔõÑùÅäÖÆ£¿£¿£¿ > > > > лл´óϺÃÇ£º£© > > _______________________________________________ > > 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 > > > > _______________________________________________ > 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/20071017/93cad09c/attachment.htm
2007年10月17日 星期三 22:50
应该不是默认调用IE的吧。我运行出错。
fn = urllib2.urlopen("http://www.sina.com.cn")
print fn.read()
File "D:\OpenSrcApp\Python25\Lib\urllib2.py", line 499, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required
在 07-10-17,beck917<beck917在gmail.com> 写道:
> proxy
> 代理??
> urllib2默认调用ie代理
>
2007年10月18日 星期四 08:59
import urllib2
proxy_handler = urllib2.ProxyHandler({'http':'http://
username:password at proxy.edu.cn:8080'})
opener = urllib2.build_opener(proxy_handler)
try:
response = opener.open('http://www.python.org')
data_web = response.read() #得到网页
print data_web
except:
print 'no' #有问题
On 10/17/07, OnMyWay <onmyway.q at gmail.com> wrote:
>
> 应该不是默认调用IE的吧。我运行出错。
>
> fn = urllib2.urlopen("http://www.sina.com.cn")
> print fn.read()
>
>
> File "D:\OpenSrcApp\Python25\Lib\urllib2.py", line 499, in
> http_error_default
> raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
> urllib2.HTTPError: HTTP Error 407: Proxy Authentication Required
>
> 在 07-10-17,beck917<beck917 at gmail.com> 写道:
> > proxy
> > 代理??
> > urllib2默认调用ie代理
> >
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20071018/cb3a88d8/attachment.html
2007年10月18日 星期四 19:20
一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20071018/7cb88073/attachment.html
2007年10月18日 星期四 19:25
一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20071018/f0a37f5f/attachment.htm
Zeuux © 2025
京ICP备05028076号