Cookies

Simon Kesenci tomega at earthlink.net
Fri Mar 16 00:49:31 EST 2001


You need the script to send a cookie header.

import Cookie
import httplib

C["compose"] = "as thou wilt"
h = httplib.HTTP("www.microsoft.com")
h.putrequest("GET", "whatever.html")
h.putheader("Accept", "text/html")
h.putheader("Cookie", C)
h.endheaders()
reply = h.getreply()

I haven't tried this.  Let me know if it works.

--S.

Ken Seehof wrote:

> Short version:
> 
> Is it possible for a stand-alone python application to read a cookie
> without the help of a browser?"
> 
> Long version:
> 
> I have a web page W and a client side python script P.  I want W to
> generate a GUID (perhaps using javascript) which is then sent to a server
> S, where it is to be used as a key in a database.  Now I run P (on the
> client, and not in a browser) and I want P to somehow find the value of
> the GUID, so that it can query the database on S.
> 
> 
> Alternate question:
> 
> Is there a technique common to both javascript and python that will obtain
> a unique identifier for a computer (e.g. IP address).  It must not be
> browser specific.
> 
> 
> Motivation:
> 
> I need to write a record of data from an html form, keyed by some kind of
> unique client id, to the server and then be able to query that record from
> a stand alone python script running on the client.  The missing link is
> getting the html form and the python script to agree on a value for the
> id; the rest is easy.
> 
> 
> - Ken
> 
> 
> 




More information about the Python-list mailing list