473,772 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cookie Module

N.K
Hi ,

Python's existing cookie module doesnt supports new cookie headers
SetCookie2 ,
How to submit a patch for that ? I tried emailing person who owns that
module.But no response.

Thanks,
Nirmal
Jul 18 '05 #1
7 4321
"N.K" wrote:

Python's existing cookie module doesnt supports new cookie headers
SetCookie2 ,
How to submit a patch for that ? I tried emailing person who owns that
module.But no response.


Have you looked at this page? http://www.python.org/dev/

Note the reference to the "Patch Manager"...

-Peter
Jul 18 '05 #2
ni**********@ho tmail.com (N.K) writes:
Python's existing cookie module doesnt supports new cookie headers
SetCookie2 ,

[...]

What do you want this for? I'm curious, and I suspect you're unaware
that the RFCs on cookies are *not* the standards followed by most of
the web -- the real 'standards' aren't really written down anywhere.

Wait a minute (my memory works slowly), didn't I write you an email
about this a while back? Are you the masochist^H^H^H ^H^H^H^H^H^Hguy
who wrote some client-side cookie-handling code for a web-crawler
(called harvestman, IIRC?)?
John
Jul 18 '05 #3
It is him alright, and I maintain HarvestMan, (Capital 'H', Capital
'M').
But I dont think Nirmal is masochist, not in any way.

I dont understand why you called him "masochist" . The reason why
we wrote our own cookie handling module using python's Cookie module
was that, the ClientCookie module was doing too many things, which
we wanted to avoid.

ClientCookie is exactly what it says, it is a module that acts as
a webclient apart from managing cookies. The ClientCookie module
borrows the methods of urllib2 like urlopen() and manages cookies
under the covers, so to say. Good design, no doubt but not what
we wanted.

ClientCookie is something like a wrapper over urllib2 plus cookie
handling. We wanted a module, which works *with* urllib2 and does
not wrap over it. With all due respect to CC, it cannot be modified
in a way to do that, withou writing klunky code, which I did not want.

Hence nirmal read the RFCs for cookie handling and implemented
a module which works *along with* urllib2 rather than wrapping over
it.
The module need special calls to set the cookie which is part of
the harvestman code(in another module), so in a way it is much
inferior to client cookie, which does it transparently.

Nirmal is talking about RFCs because we want to have a very correct
technical cookie implementation for our module, no matter what web
servers
does in their wheels and geats. I know that the SetCookie2 method uses
latest cookie RFC, which almost no webserver supports, but still the
question should be taken in a spirit of technical correctness.

Yeah it has an academic quality to it, not of much pratical use maybe
right now, but I cannot understand how it makes the guy a masochist.

-Anand Pillai

jj*@pobox.com (John J. Lee) wrote in message news:<87******* *****@pobox.com >...
ni**********@ho tmail.com (N.K) writes:
Python's existing cookie module doesnt supports new cookie headers
SetCookie2 ,

[...]

What do you want this for? I'm curious, and I suspect you're unaware
that the RFCs on cookies are *not* the standards followed by most of
the web -- the real 'standards' aren't really written down anywhere.

Wait a minute (my memory works slowly), didn't I write you an email
about this a while back? Are you the masochist^H^H^H ^H^H^H^H^H^Hguy
who wrote some client-side cookie-handling code for a web-crawler
(called harvestman, IIRC?)?
John

Jul 18 '05 #4
N.K
> What do you want this for? I'm curious, and I suspect you're unaware
that the RFCs on cookies are *not* the standards followed by most of
the web -- the real 'standards' aren't really written down anywhere.

True,I was forced to use RFC 2965. And there are more reserved
keywords such as 'port' , 'Discard' etc. Anyway it is not a bad thing
to update a module.

_reserved = { "expires" : "expires",
"path" : "Path",
"comment" : "Comment",
"domain" : "Domain",
"max-age" : "Max-Age",
"secure" : "secure",
"version" : "Version",

}

Wait a minute (my memory works slowly), didn't I write you an email
about this a while back? Are you the masochist^H^H^H ^H^H^H^H^H^Hguy
who wrote some client-side cookie-handling code for a web-crawler
(called harvestman, IIRC?)?

I discarded my yahoo email id because of spam - Sorry for not
replying. I am not that busy guy, normally i reply to almost all
emails :-)
Jul 18 '05 #5
py*******@Hotpo p.com (Anand Pillai) schreef:
Yeah it has an academic quality to it, not of much pratical use maybe
right now, but I cannot understand how it makes the guy a masochist.


JJL did implement it in ClientCookie, so I'm sure he knows by experience
what a masochist is... ;-)

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
Jul 18 '05 #6
ni**********@ho tmail.com (N.K) writes:
What do you want this for? I'm curious, and I suspect you're unaware
that the RFCs on cookies are *not* the standards followed by most of
the web -- the real 'standards' aren't really written down anywhere.

True,I was forced to use RFC 2965.


Who forced you?

And there are more reserved
keywords such as 'port' , 'Discard' etc. Anyway it is not a bad thing
to update a module.

[...]

What? I'm not certain I understand you, but I'll say again
(especially since my second response to Anand seems to have vanished
again): RFC 2965 is not only defunct as an internet protocol, it has
*never* been used by more than a vanishing fraction of the internet.
John
Jul 18 '05 #7
[reposting since the original seems to have vanished]

py*******@Hotpo p.com (Anand Pillai) writes:
It is him alright, and I maintain HarvestMan, (Capital 'H', Capital
'M').
But I dont think Nirmal is masochist, not in any way.

I dont understand why you called him "masochist" . The reason why
we wrote our own cookie handling module using python's Cookie module
was that, the ClientCookie module was doing too many things, which
we wanted to avoid.
Anand, first, it wasn't said with the *slightest* malice (after all, I
meet my own criterion for masochism)!

Still, I certainly *do* think you're duplicating effort for no obvious
reason. You're quite at liberty to do that, of course, but so am I to
call you a masochist for it ;-)

ClientCookie is exactly what it says, it is a module that acts as
a webclient apart from managing cookies. The ClientCookie module
borrows the methods of urllib2 like urlopen() and manages cookies
under the covers, so to say. Good design, no doubt but not what
we wanted.
Well, no. It provides convenient replacements for the urllib2
callables (that's what _urllib2_suppor t.py is for). It certainly
doesn't *require* you use that urllib2-wrapping stuff. All it
requires is that you give CookieJar.extra ct_cookies /
..add_cookie_he ader trivial request and response objects. In fact,
since I happen to know that HarvestMan uses urllib2, I know you
already *have* such objects.

No wrapping involved:

import urllib2, ClientCookie

cj = ClientCookie.Co okieJar()
request = urllib2.Request ("http://www.example.com/")
cj.add_cookie_h eader(request)
response = urllib2.urlopen (request)
cj.extract_cook ies(response, request)
....etc
It couldn't really be much simpler! In fact, I see your own
CookieManager.S etCookie and CookieManager.a dd_cookie_heade r methods
are directly analogous (if slightly less convenient, less
standards-compliant, more ignorant of the de-facto cookie standard,
and more buggy -- well OK, maybe not more buggy ;-).

Well, OK, it could be simpler if you didn't even have to call those
methods on cj. But of course, that's what the urllib2-replacement
stuff is for, to add entirely automatic cookie handling:

ClientCookie.ur lopen(request) # no need for any tiresome method calls
You're entirely free to use or ignore that stuff.

Why does that optional support *wrap* urllib2 instead of *extending*
it with a CookieHandler? Good question. If you want to have the
urllib2 interface with automatic cookie handling in the sense above,
you're currently *forced* to replace (parts of) urllib2 rather than
extend it, due to the current design of urllib2. I hope to change
that with a patch I've submitted and Jeremy Hylton plans to look at in
his Copious Free Time.

ClientCookie is something like a wrapper over urllib2 plus cookie
handling. We wanted a module, which works *with* urllib2 and does
not wrap over it. With all due respect to CC, it cannot be modified
in a way to do that, withou writing klunky code, which I did not want.
That's just a misunderstandin g -- it *has* been that way for a long
time. Just ignore, or throw away, _urllib2_suppor t.py!

Hence nirmal read the RFCs for cookie handling and implemented
Well, as I tried to tell Nirmal (unfortunately it seems that email
address was dead), and as is explained in tiresome (though far from
exhaustive) detail in the ClientCookie docs, browsers don't actually
implement the RFCs. Well, lynx makes a good attempt at RFC 2109, and
Opera does for 2965, but as long as the big browsers don't implement
them -- and it's almost a certainty they never will -- nobody will
actually be *using* either standard! They're just there to trip you
up <0.7 wink>. As is the original cookie_spec.htm l, actually: it only
bears a passing resemblence to the de facto standard actually used on
the internet. Of course, as long as your userbase is sufficiently
small (please don't feel insulted: the userbase of my code is
doubtless pretty tiny), you may not notice (though I suspect you
will), but people like Ronald Tschalar, author of a Java library
called HTTPClient, have found themelves spending inordinate amounts of
time fixing problems that arise by trying to implement only the RFCs,
or by naievely trying to combine the RFCs with the Netscape protocol.
Of course, you can get around that to a large extent by not bothering
to implement the security rules properly (which may be quite a
reasonable thing to do in some cases).

[...] Nirmal is talking about RFCs because we want to have a very correct
technical cookie implementation for our module, no matter what web
servers
does in their wheels and geats. I know that the SetCookie2 method uses
latest cookie RFC, which almost no webserver supports, but still the
question should be taken in a spirit of technical correctness.
Your module claims to implement 2109, officially obsolete. Fine
(though I suspect it's quite far from a full implementation) . As for
2965 (the standard that officially obsoletes 2109, and which
ClientCookie does implement in addition to the Netscape protocol),
even David Kristol seems to have given up on it, as has the single guy
who was driving the effort to rescue it from compatibility problems
with the Netscape protocol (Daniel Kian McKiernan). RFC 2965 now
seems utterly dead as an internet protocol.

Yeah it has an academic quality to it, not of much pratical use maybe

[...]

As you say.
John
Jul 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
2120
by: Manlio Perillo | last post by:
Hi. I'm using the Cookie module (on the client side). I have found a problem trying to parse the cookie: "Set-Cookie: value=thevalue; path=/; expires=Fri, 21-May-2004 10:40:51 GMT" The date is not parsed correctly, only "Fri," is matched.
6
2198
by: Ajay | last post by:
hi! i am printing a simple cookie, but instead of printing um=name:blah&access:admin&exp:2312390.909 its printing um="name:blah&access:admin&exp:2312390.909" why the quotes?
6
3874
by: Larry Rebich | last post by:
How do I read and write a cookie in an ASP.Net module? I can get this code to work in an aspx.vb class but not in a regular VB module: Response.Cookies.Add(c) Response is not a recognized command in the module. I've tried importing System.Web into the module but that is not allowed.
3
2487
by: Dan | last post by:
Hi, I am trying to refresh the cookie to make sure the timeout is reset by simply calling a blank page on my site. I am doing this because I have an external site hosted in my web that isn't sharing the auth mechanism. I can test this easily by simply having a hidden iframe and use a javascript call to refresh my sites blank page every time the external site loads a page and this does work fine, the cookie is refreshed as expected if...
4
1268
by: rodmc | last post by:
Hi, I am trying to set a cookie on a client computer using the Cookie module however all I get is the text being printed in the browser window. Can anyone point me in the right direction so that the cookie data is set without it appearing in the browser? A shortened version of the code is below, in the full version there is also userID check, this seems to work ok. I have removed that portion for the time being as its the writing part that...
2
1750
by: Damodhar | last post by:
HI friends, # any one say where the cookie files are stored and whats the path and whats the extension for the cookie files in php,this is client side variable.can u say the path for cookie # please any one know about the Cross domain cookie hoe to set the cookie for one are more domain's. can u say the syntax for the cross domain cookie
5
1691
by: sophie_newbie | last post by:
Does anyone know how to do this? I can't seem to make it work. I'm using: c = Cookie.SimpleCookie() c = "unamepwordwhatever" c.expires = time.time() + 300 print c
5
3163
by: cbhoem | last post by:
Hi - I am trying my hand at python cookies. I'm confused about a few things though. Do the python cookies get written to a cookies text file? I have simple code below -- I see the cookie in my HTTP header but do not get anything in the cookie text file. I'm working on linux. print "Content-type: text/html" cookie = Cookie.SimpleCookie()
0
930
by: Chris Rebert | last post by:
See the 'cookie' module: http://www.python.org/doc/2.5.2/lib/module-Cookie.html Also: A. In the future, Google is your friend! That page is the top hit for "python cookie" for Christ's sake; it's not hard to find. B. Please don't post your question again just because it isn't answered fast enough. You didn't even wait one whole day before reposting. Cheers,
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.