Page MenuHomePhabricator

Pywikibot add is_locked() function
Closed, ResolvedPublicFeature

Description

pywikibot's user object should have a function to check if an account is currently locked. I would envision this working almost identically to isBlocked(), which is already implemented.

Details

Related Changes in Gerrit:

Event Timeline

TheSandDoctor changed the subtype of this task from "Task" to "Feature Request".Apr 4 2020, 12:08 AM

The "vanilla" requests code that would accomplish this (using the same format as API:Users) is:

import requests
S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"


PARAMS = {
    "action": "query",
    "format": "json",
    "meta": "globaluserinfo",
    "guiuser": "TonjaHeritage2",
    "guiprop": "groups|merged|unattached"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print('locked' in DATA["query"]["globaluserinfo"])
Xqt renamed this task from Pywikibot add isLocked() function to Pywikibot add is_locked() function.Apr 4 2020, 6:31 AM
Xqt triaged this task as Medium priority.

Change 738509 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [IMPR] Provide is_locked method

https://gerrit.wikimedia.org/r/738509

Change 738509 merged by jenkins-bot:

[pywikibot/core@master] [IMPR] Provide is_locked method

https://gerrit.wikimedia.org/r/738509