Movatterモバイル変換
[0]ホーム
Re: Réf. : Re: Help for urllib error : 'no host given'
Steve Holdensholden at holdenweb.com
Thu Apr 12 08:57:01 EDT 2001
<Patrick.Bussi at space.alcatel.fr> wrote in messagenews:mailman.987070578.13268.python-list at python.org...>> Hi Steve,>> Thank you for your investigation. It helps me understand that my pythoncode is> correct. I did not forget any character, while the name of the url comesfrom> regex extract of the page returned by the server itself. But you're righton the> fact that the name has something wrong, when used in this way.> I tested the web site "manually", that is pasting the entire name of theweb> site directly into my Netscape. Same result : "Netscape can't locate theserver.> No host specified" (this message translated from French)>> Therefore the question is : how does it come that a Javascript functionusing> 'document.location="http://blablabla"' is able to redirect my browser tothe> said web site, and not 'urllib.urlopen("http://blablabla")' ?>> More, I do not understand the error message. Does it come from the serverwhich> denies the request *or* from the dns which cannot translate the name intoan> address *or* from Netscape which seems not to receive/understand the hostname ?>Essentially it comes from the httplib code, which examines the URL, breaksit up into various components, and does not find a host component. This iswhy I wondered whether you had missed a slash out: "http/hostname" raisesthat exact exception.I would suggest you use urllib to read the URLs. The httplib is mostlysupport code for that library.regards Steve
More information about the Python-listmailing list
[8]ページ先頭