Update Aug 08, 2011: Some changes made thanks to updates in the new
So I’ve been spending the past week and a half working on EarwigBot’s new
wikitools framework thing (to avoid confusion with Mr.Z-man’s
python-wikitools package, I’m referring to it as “EarwigBot’s Wiki Toolset”
in the docs, even though it’s just
wiki internally). Basically, it’s the
interface between EarwigBot and the MediaWiki API.
As Josh put it, this is “the thing that actually makes it work”.
So, now you can do this (from within Python’s interpreter, a wiki bot task, or an IRC command):
config.json file stores site information, along with our chosen “default
site”. Pretty neat, huh? “But what can it actually do?” I hear you ask? Well,
for example, we can get information about users:
and pages as well, with intelligent namespace logic:
and with support for redirect following:
Of course, a Wiki Toolset would be nothing without login! Our username and
password are stored (encrypted with Blowfish) in the bot’s
and we login automatically whenever we create a new Site object – unless
we’re already logged in, of course, and we know that based on whether we have
valid login cookies.
Cookies are stored in a special
.cookies file in the project root (with no
access given to other users, of course). We support both per-project login and
CentralAuth, meaning I can do…
without making additional logins. One thing I strove for when designing the toolset was as minimal API usage as possible – we accept gzipped data, we don’t make API queries unless they’re actually requested, and we combine queries whenever possible. Of course, I’m probably doing it all wrong, but it seems to be working so far.
- So… yeah. Carry on then!