Passing a CookieJar instead of a cookieproc to urllib2.build_opener

Discussion in 'Python' started by rrenaud@gmail.com, Jul 10, 2007.

  1. Guest

    urllib2.build_opener happily accepts and ignores a FileCookieJar. I
    had a bug in my code which looked like

    urllib2.build_opener(func_returning_cookie_jar())

    which should have been

    urllib2.build_opener(HTTPCookieProcessor(func_returning_cookie_jar())

    The problem is that the code ran happily without actually sending the
    cookie, the CookieJar was just ignored. I think that build_opener
    should throw an exception when add_handler doesn't actually add.

    Is this worth filing a bug for, or is it acceptable behavior?
    , Jul 10, 2007
    #1
    1. Advertising

  2. John J. Lee Guest

    "" <> writes:

    > urllib2.build_opener happily accepts and ignores a FileCookieJar. I
    > had a bug in my code which looked like
    >
    > urllib2.build_opener(func_returning_cookie_jar())
    >
    > which should have been
    >
    > urllib2.build_opener(HTTPCookieProcessor(func_returning_cookie_jar())
    >
    > The problem is that the code ran happily without actually sending the
    > cookie, the CookieJar was just ignored. I think that build_opener
    > should throw an exception when add_handler doesn't actually add.
    >
    > Is this worth filing a bug for, or is it acceptable behavior?


    IMO, it's worth filing iff:

    a) you think it's worthwhile (this one sounds worthwhile to me)

    b) you write a patch and are prepared to patiently keep at it until it
    gets applied

    Make sure your patch follows PEP 8. Make sure the patch includes test
    and documentation updates / additions (you don't need to write docs in
    LaTeX format -- other people will do the conversion to LaTeX for you
    if you like). If there are no doc changes required, state that
    explicitly in the patch tracker. If your patch gets ignored, review
    five other patches, and post to python-dev stating you have done so
    and requesting that your patch is reviewed (there's a shortage of
    patch reviewers).


    John
    John J. Lee, Jul 11, 2007
    #2
    1. Advertising

  3. Guest

    On Jul 10, 11:10 pm, (John J. Lee) wrote:
    > "" <> writes:
    > > urllib2.build_opener happily accepts and ignores a FileCookieJar. I
    > > had a bug in my code which looked like

    >
    > > urllib2.build_opener(func_returning_cookie_jar())

    >
    > > which should have been

    >
    > > urllib2.build_opener(HTTPCookieProcessor(func_returning_cookie_jar())

    >
    > > The problem is that the code ran happily without actually sending the
    > > cookie, the CookieJar was just ignored. I think that build_opener
    > > should throw an exception when add_handler doesn't actually add.

    >
    > > Is this worth filing a bug for, or is it acceptable behavior?

    >
    > IMO, it's worth filing iff:
    >
    > a) you think it's worthwhile (this one sounds worthwhile to me)
    >
    > b) you write a patch and are prepared to patiently keep at it until it
    > gets applied
    >
    > Make sure your patch follows PEP 8. Make sure the patch includes test
    > and documentation updates / additions (you don't need to write docs in
    > LaTeX format -- other people will do the conversion to LaTeX for you
    > if you like). If there are no doc changes required, state that
    > explicitly in the patch tracker. If your patch gets ignored, review
    > five other patches, and post to python-dev stating you have done so
    > and requesting that your patch is reviewed (there's a shortage of
    > patch reviewers).
    >
    > John


    The patch is on the tracker here.
    http://sourceforge.net/tracker/index.php?func=detail&aid=1750931&group_id=5470&atid=305470

    Are the docs themselves in subversion? I suppose I should also update
    the doc at http://docs.python.org/lib/module-urllib2.html
    , Jul 11, 2007
    #3
  4. John J. Lee Guest

    John J. Lee, Jul 11, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Josef Cihal
    Replies:
    0
    Views:
    743
    Josef Cihal
    Sep 5, 2005
  2. 7stud

    Re: Cookies and CookieJar

    7stud, May 17, 2008, in forum: Python
    Replies:
    0
    Views:
    412
    7stud
    May 17, 2008
  3. Roy Smith

    Debugging cookielib.CookieJar

    Roy Smith, Jul 19, 2011, in forum: Python
    Replies:
    1
    Views:
    272
    Roy Smith
    Jul 19, 2011
  4. Stefan Kruger
    Replies:
    2
    Views:
    106
    Stefano Crocco
    Nov 10, 2008
  5. Thufir

    cookiejar without cgi

    Thufir, Feb 1, 2010, in forum: Ruby
    Replies:
    2
    Views:
    176
    Thufir
    Feb 1, 2010
Loading...

Share This Page