Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Accessing Web site contents from a Python script (with use of Cookie)

Reply
Thread Tools

Accessing Web site contents from a Python script (with use of Cookie)

 
 
Aki Niimura
Guest
Posts: n/a
 
      07-08-2003
Hello everyone,

I have been trying to write a Python script to access a Web site.

I'm currently having a problem completing my script because the contents
I would like to access in the Web site is a dynamic content and it is
generated based on the Cookie contents which are set in another page.

url-a (setting Cookies)
url-b (dynamic content based on the Cookie value)

I'm using httplib.HTTPConnection() to first access the url-a to get other info
(and Cookies in header). Then my script accesses the url-b but it doesn't
work as no Cookie info is returned when the url-b is being accessed.

The Cookie values vary time to time such that the script must obtain them
from the url-a. Also, no expiration is set in the Cookies such that they are
supposed to live only in browser not in Cookie files.

Is there any way to handle the situation mentioned above?

Any comments, any hints are highly appreciated.

Best regards,
Aki Niimura
 
Reply With Quote
 
 
 
 
Ian Bicking
Guest
Posts: n/a
 
      07-08-2003
On Mon, 2003-07-07 at 23:50, Aki Niimura wrote:
> I'm currently having a problem completing my script because the contents
> I would like to access in the Web site is a dynamic content and it is
> generated based on the Cookie contents which are set in another page.


You should use ClientCookie:
http://wwwsearch.sourceforge.net/ClientCookie/

Ian



 
Reply With Quote
 
 
 
 
Aki Niimura
Guest
Posts: n/a
 
      07-08-2003
Ian Bicking <(E-Mail Removed)> wrote in message
> On Mon, 2003-07-07 at 23:50, Aki Niimura wrote:
> > I'm currently having a problem completing my script because the contents
> > I would like to access in the Web site is a dynamic content and it is
> > generated based on the Cookie contents which are set in another page.

>
> You should use ClientCookie:
> http://wwwsearch.sourceforge.net/ClientCookie/


Thank you for getting me know such interesting Python module is available.

I made my script working using HTTPResponse.getheader('Set-Cookie') and
HTTPResponse.putheader('Cookie', cookie). Using ClientCookie would make
such process hidden. I should use it next time.

Thanks!
Aki Niimura
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
List of free web site design, web site backgrounds, web site layoutsresources cyber XML 1 12-25-2007 11:48 PM
Free web site design, web site backgrounds, web site layoutsresources cyber HTML 0 12-24-2007 04:26 PM
List of free web site design, web site backgrounds, web site layoutsresources cyber HTML 0 12-21-2007 03:47 PM
List of free web site design, web site backgrounds, web site layoutsweb sites cyber HTML 1 12-19-2007 09:07 AM
This web site creates a *popup window* => how fetch contents in a script? seberino@spawar.navy.mil Python 6 03-09-2007 11:21 PM



Advertisments