Page MenuHomePhabricator

Allow pywikibot to tell type of block
Closed, ResolvedPublicFeature

Description

It would be fantastic if pywikibot's User had an option to tell whether the block is full or partial. Currently, it just has is_blocked() which is a boolean. Perhaps there should either be more information returned or a new method added for is_partial_block() is something?

A brief example of current behaviour on enwiki, with a partially blocked user.

>>> import pywikibot
>>> site = pywikibot.Site()
>>> user = pywikibot.User(site, "~2025-39752-31")
>>> user
User('User:~2025-39752-31')
>>> user.is_blocked()
True

Details

Event Timeline

Peachey88 changed the subtype of this task from "Task" to "Feature Request".Dec 14 2025, 1:22 AM
Pppery renamed this task from Feature request: allow pywikibot to tell type of block to Allow pywikibot to tell type of block.Dec 14 2025, 2:51 AM

Change #1217850 had a related patch set uploaded (by WASP-Outis; author: Wasp-Outis):

[pywikibot/core@master] Add partial block detection for User and Site

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

I have submitted the patch for review:
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1217850

I've added this methods:

  • is_partial_block() to detect partial blocks
  • get_block_info() to get detailed block information

Both methods are available on User and Site objects.

Thanks so much for taking this on, @WASP-Outis! I am impressed by how fast this was actioned. Usually ideas sit for quite some time. I still have some sitting from years ago, though not for pywikibot haha.

@TheSandDoctor: As my second task of first day of activity on phabricator, I was very motivated today :))

Change #1217850 merged by jenkins-bot:

[pywikibot/core@master] Add partial block detection for User and Site

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