HomePhabricator

Use mwapi for anonymous API requests

Tags
None
Referenced Files
None
Subscribers
None

Description

Use mwapi for anonymous API requests

I first wrote the anonymous API requests using urllib.request.urlopen(),
then later added the mwapi library for OAuth requests – but we might as
well use that library for anonymous requests as well, it makes the code
nicer and also gives us better error handling for free.

Also use formatversion=2 for authenticated requests, while we’re at it,
now that I learned about this Session constructor parameter.

Note that this has the effect that we now get image metadata
(attribution) from www.wikidata.org instead of commons.wikimedia.org,
but that’s not a problem, since MediaWiki supports that.

Details

Provenance
LucasWerkmeisterAuthored on Nov 3 2018, 2:45 PM
Parents
R2422:f394936bd6a1: Fix image display for image titles containing spaces
Branches
Unknown
Tags
Unknown
ChangeId
None