Huji has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/761111 )
Change subject: [bugfix] detect range blocks with Page.is_blocked() ......................................................................
[bugfix] detect range blocks with Page.is_blocked()
Bug: T301282 Change-Id: I135d7bc492bc5347041aaab8edeb830b6b5b0d8f --- M pywikibot/page/__init__.py 1 file changed, 3 insertions(+), 2 deletions(-)
Approvals: Huji: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/page/__init__.py b/pywikibot/page/__init__.py index 3c5aca7..afe7df4 100644 --- a/pywikibot/page/__init__.py +++ b/pywikibot/page/__init__.py @@ -2919,7 +2919,7 @@ if not hasattr(self, '_userprops'): self._userprops = list(self.site.users([self.username, ]))[0] if self.isAnonymous(): - r = list(self.site.blocks(users=self.username)) + r = list(self.site.blocks(iprange=self.username, total=1)) if r: self._userprops['blockedby'] = r[0]['by'] self._userprops['blockreason'] = r[0]['reason'] @@ -2954,7 +2954,8 @@ """Determine whether the user is currently blocked.
.. versionchanged:: 7.0 - renamed from :meth:`isBlocked` method + renamed from :meth:`isBlocked` method, + can also detect range blocks.
:param force: if True, forces reloading the data from API """