How to share session with IE

Bernard bernard.chhun at gmail.com
Tue Oct 10 07:36:17 EDT 2006


Hello Dapu,

You can do the same thing as IE on your forum using urllib2 and
cookielib. In short you need to code a small webcrawler. I can give you
my browser module if necessary.
You might not have the time to fiddle with the coding part or my
browser module so you can also use this particularly useful module :
http://wwwsearch.sourceforge.net/mechanize/
The documentation is pretty clear for an initiated python programmer.
If it's not your case, I'd recommend to read some ebooks on the python
language first to get use to it.

Bernard




zdp wrote:
> Hello!
>
> I need to process some webpages of a forum which is powered by discuz!.
> When I login, there are some options about how long to keep the
> cookies: forever, month, week, et al. If I choose forever,  I don't
> need to login each time, and When I open the internet explorer I can
> access any pages directly. Some urls of the pages like:
>
>     http://www.somesite.com/bbs/viewthread.php?tid=12345&extra=page%3D1
>
> However, now I need to process some pages by a python program. When I
> use urllib.urlopen(theurl), I can only get a page which told me I need
> login. I think It's reasonable, becuase I wasn't in a loggined session
> which as IE did.
>
> So how can I do my job? I want to get the right webpage by the url. I
> have search answers from the groups but didn't get clear answer. Should
> I use win32com or urllib? Any reply or information is appreciate. Hope
> I put it clear.
> 
> Dapu




More information about the Python-list mailing list