urllib.urlopen doesn't work

Steve Holden steve at holdenweb.com
Sat Sep 3 02:09:35 EDT 2005


Josef Cihal wrote:
> Hallo,
>  
> i need a help with module URLLIB.
>  
> I am trying to open url via:
> -    urllib.urlopen
> ('http://brokerjet.ecetra.com/at/markets/stocks/indices.phtml?notation=92866')
>  
>  
> Problem is, that I am always redirecting to
> - LOGIN page (www.brokerjet.at <http://www.brokerjet.at>),
> and cannot get my page with "news", which I want to download.
>  
> Can it be, that I forgot to pass all (hidden too) parameters to form by 
> submit?
>  
> Is it possible to get (ask) for all existing valid parameters, which I 
> need to pass to form
> for getting requested page?
> Is action submit correct in my case?
>  
>  
> Thank you very much for all your help or ideas
>  
I suspect that the problem is you are attempting to access a web 
application in which every page checks for a valid login and, if this 
isn't present, redirects you to the login page.

You might try a URL for the form

     http://username:password@server/path/resource

as this is the easiest way to achieve basic authentication. Otherwise 
there are other ways, which you can get back to us about.

Also you might try just starting a new browser session an entering the 
URL that gave you problems in your code. If the browser displays the 
page correctly then *either* it has cookies set that you aren't setting 
when you call urllib.urlopen() *or* I'm wrong. :-)

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC             http://www.holdenweb.com/




More information about the Python-list mailing list