Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Accessing Web site contents from a Python script (with use of Cookie) (http://www.velocityreviews.com/forums/t319365-accessing-web-site-contents-from-a-python-script-with-use-of-cookie.html)

Aki Niimura 07-08-2003 04:50 AM

Accessing Web site contents from a Python script (with use of Cookie)
 
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

Ian Bicking 07-08-2003 07:05 AM

Re: Accessing Web site contents from a Python script (with use ofCookie)
 
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




Aki Niimura 07-08-2003 08:57 PM

Re: Accessing Web site contents from a Python script (with use of Cookie)
 
Ian Bicking <ianb@colorstudy.com> 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


All times are GMT. The time now is 02:33 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57