Restoring override of urllib.URLopener.open_https
exarkun at divmod.com
Fri Oct 6 04:55:31 CEST 2006
On Fri, 6 Oct 2006 02:22:23 GMT, Bakker A <arno at cs.vu.nl> wrote:
>In article <16hai25meev3316o19tgmh646futjblfgl at 4ax.com>,
>goyatlah <seresta At wanadoo Dot nl> wrote:
>>I think that you need a superclass above the M2Crypto one, and change
>>the open_https method back to the urllibs one.
>I'm not sure I get your suggestion. What the M2Crypto module does is:
> import m2urllib
>in its __init__.py, which blatantly does
> from urllib import *
> URLopener.open_https = open_https
>in turn, so there's no subclassing going on, and AFAIK, the original urllib
>code is irreversibly overwritten. Am I right?
Mostly. However, Try importing urllib first, grabbing the open_https function,
then importing M2Crypto, then reversing what M2Crypto did by putting the
original open_https function back onto URLopener.
More information about the Python-list