diff --git a/.github/workflows/oauth_tests-ci.yml b/.github/workflows/oauth_tests-ci.yml index 9435725830..2af22aa8e0 100644 --- a/.github/workflows/oauth_tests-ci.yml +++ b/.github/workflows/oauth_tests-ci.yml @@ -84,11 +84,12 @@ jobs: python -m pip install --upgrade pip pip --version pip install coverage + # tomli required for coverage due to T380697 pip install "tomli; python_version < '3.11'" pip install "importlib_metadata ; python_version < '3.8'" pip install mwparserfromhell # PyJWT added due to T380270 - pip install "PyJWT != 2.10.0 ; python_version > '3.8'" + pip install "PyJWT != 2.10.0, != 2.10.1 ; python_version > '3.8'" pip install mwoauth pip install packaging pip install requests diff --git a/pywikibot/login.py b/pywikibot/login.py index c4357736bd..1a714e16c7 100644 --- a/pywikibot/login.py +++ b/pywikibot/login.py @@ -592,7 +592,12 @@ def access_token(self) -> tuple[str, str] | None: @property def identity(self) -> dict[str, Any] | None: - """Get identifying information about a user via an authorized token.""" + """Get identifying information about a user via an authorized token. + + .. versionchanged:: 9.6 + *leeway* parameter for ``mwoauth.identify`` function was + increased to 30.0 seconds. + """ if self.access_token is None: pywikibot.error('Access token not set') return None @@ -601,8 +606,12 @@ def identity(self) -> dict[str, Any] | None: access_token = mwoauth.AccessToken(*self.access_token) try: identity = mwoauth.identify(self.site.base_url(self.site.path()), - consumer_token, access_token) - return identity + consumer_token, + access_token, + leeway=30.0) except Exception as e: pywikibot.error(e) - return None + else: + return identity + + return None diff --git a/requirements.txt b/requirements.txt index df401ab5a6..4193d61c53 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,7 +33,7 @@ wikitextparser>=0.47.5 # mwoauth 0.2.4 is needed because it supports getting identity information # about the user # Due to T380270 PyJWT must be set -PyJWT != 2.10.0; python_version > '3.8' +PyJWT != 2.10.0, != 2.10.1; python_version > '3.8' mwoauth>=0.2.4,!=0.3.1 # interwiki_graph.py module and category_graph.py script: diff --git a/setup.py b/setup.py index 3a56fbc6b1..3f3953eafb 100755 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ 'Pillow>=10.4; python_version >= "3.13"', ], 'mwoauth': [ - 'PyJWT != 2.10.0; python_version > "3.8"', # T380270 + 'PyJWT != 2.10.0, != 2.10.1; python_version > "3.8"', # T380270 'mwoauth!=0.3.1,>=0.2.4', ], 'html': ['beautifulsoup4>=4.7.1'],