urllib2 for HTTPS/SSL

Jeremy Hylton jeremy at alum.mit.edu
Wed Jul 9 16:22:11 CEST 2003

On Wed, 2003-07-09 at 05:29, Kylotan wrote:
> Jeremy Hylton <jeremy at alum.mit.edu> wrote in message news:<mailman.1057668851.8514.python-list at python.org>...
> > On Tue, 2003-07-08 at 06:33, Kylotan wrote:
> > > I have no idea how (or if) to use the 'HTTPSHandler' object, or what
> > > the correct way for me to request an SSL connection is. Does anybody
> > > have any hints? And additionally, is there any chance of the official
> > > documentation on this useful-looking module being improved?
> > 
> > Unless I misunderstand your intent, you don't need to use the Handler
> > object directly.  HTTPS support is provided automatically, so long as
> > your local Python has SSL support.  (It should.)
> Ok, so what you're saying is that the stuff documented in:
> "Python Library Reference - 11.5.14 HTTPSHandler Objects"
> is purely an implementational detail?  In other words, they're
> specifying examples of Handler classes in case you wanted to see how
> to write one yourself, but to use the urllib2 library normally you'd
> never need to really know this?

urllib2 provides a framework for writing custom handlers.  If you want
to create your own handlers or an opener with a custom set of handlers,
this documentation may be helpful.

> I'm guessing the OpenerDirector object tries the URL with each
> BaseHandler-derived object to see which one should handle it.

That's about right.  Most of the handlers are registered for particular
protocols.  So the opener knows to use the HTTPSHandler for https://


More information about the Python-list mailing list