jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1099298?usp=email )

Change subject: tests: Update PyJWT requirements
......................................................................

tests: Update PyJWT requirements

- PyJWT < 2.10.0 is required due to
  https://github.com/jpadilla/pyjwt/issues/1017
- increase leeway for mwoauth.identify function because the default
  value of 10.0 seconds is too low sometimes
- add __repr__ method for LoginManager

Bug: T380270
Change-Id: Ie7fadb26f5a3947343feb302f58098d266af2fee
---
M .github/workflows/oauth_tests-ci.yml
M pywikibot/login.py
M requirements.txt
M setup.py
4 files changed, 17 insertions(+), 7 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/.github/workflows/oauth_tests-ci.yml 
b/.github/workflows/oauth_tests-ci.yml
index 9435725..2af22aa 100644
--- a/.github/workflows/oauth_tests-ci.yml
+++ b/.github/workflows/oauth_tests-ci.yml
@@ -84,11 +84,12 @@
         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 c435773..1a714e1 100644
--- a/pywikibot/login.py
+++ b/pywikibot/login.py
@@ -592,7 +592,12 @@

     @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 @@
         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 df401ab..4193d61 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -33,7 +33,7 @@
 # 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 3a56fbc..3f3953e 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'],

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1099298?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ie7fadb26f5a3947343feb302f58098d266af2fee
Gerrit-Change-Number: 1099298
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to