I'm using Python 2.4 and 2.7 for different apps. I'm happy with a solution for either one.
I've got to talk to a url that uses a session cookie. I only need to set this when I'm developing/debugging so I don't need a robust production solution and I'm somewhat confused by the docs on cookielib. I can use urllib2 without cookielib just fine, but need the cookie to add some security. I'm normally using Firefox 4.0 to login to the server and get the cookie. After that I need some way to set the same cookie in my python script. I can do this by editing my code, since I only need it while defeloping from my test W7 box. I was hoping to find something like ...set_cookie('mycookiename', 'myvalue', 'mydomain.org') I've googled this most of the morning and found everything but what I need, or I just don't understand the basic concept. Any pointers would be greatly appreciated. One of my false starts looks like this. But I get a ... File "C:\alltools\python26\lib\urllib2.py", line 518, in http_error_default raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 500: Access Deinied def test1(): cj = cookielib.MozillaCookieJar() cj.load('C:/Users/myname/Desktop/cookies.txt') opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) r = opener.open("http://daffyduck.mydomain.org/wsgi/myapp.wsgi") print r.read() return -- http://mail.python.org/mailman/listinfo/python-list