[Tutor] fetching wikipedia articles
Alan Gauld
alan.gauld at btinternet.com
Fri Jan 23 14:51:58 CET 2009
"Kent Johnson" <kent37 at tds.net> wrote
>> Rather than editing the existing code and making it non standard
>> why not subclass robotparser:
> That won't work, it is urllib.URLOpener() that he is patching and
Sorry, yes I misread that post as modifying robotparser, it
should have been URLOpener.
But...
> robotparser does not supply a way to change the URLOpener subclass
> that it uses.
I didn't realize that. So you would need to cut n' paste the
robotparser
read() method into a subclass of robotparser too. Which is almost
as messy as editing the original source. Such a shame that the
author didn't either put the opener as an attribute or as a defaulted
parameter of read!
Pity, I hate to see editing of existing classes in an OO system.
Alan G.
More information about the Tutor
mailing list