Add cookie handling to the open_url method in the urls lib

Hi,

I am trying to avoid using a third party http libraries in a module I am building for a system that requires cookie handling. In open_url’s current implementation I receive the following return code and message:

urllib2.HTTPError: HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop. The last 30x error message was:

Adding the urllib2.HTTPCookieProcessor handler like below:

handlers.append(urllib_request.HTTPCookieProcessor)

Resolves this issue and results in a successful 200 return code.

I would like to do two things:

  1. Validate that this is an acceptable fix for my issue
  2. Identify if something for this is already in the works or if I should submit a pull request with my proposed fix.
    Assuming a pull request is the appropriate course of action, does it make sense to make an additional param for open_url to enable this functionality or to just add it as a handler irregardless or the need?

Thanks in advance for feedback and guidance!

-Craig