Login to website using urllib2

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Sep 19 11:34:31 CEST 2008


En Thu, 18 Sep 2008 10:23:50 -0300, Mohit Ranka <mohitranka at gmail.com>  
escribió:

>              I am trying to fetch HTML content from a website that has
> different version of pages for "logged" users and "guseuests" users. I  
> need
> to fetch the "logged" user pages. The problem is, even with the use of  
> basic
> authentication, I am getting "guest" user page with urllib2.urlopen. The
> code can be seen here.
>
> http://pastebin.com/m7301084a
>
> Any suggestions/pointers/solutions?

Your second call to urllib2.install_opener completely replaces the former  
opener; you should combine both handlers before installing ONE opener.

-- 
Gabriel Genellina




More information about the Python-list mailing list