jenkins-bot has submitted this change and it was merged.
Change subject: Fix encode_url dict support on Python 3 ......................................................................
Fix encode_url dict support on Python 3
Bug: T85321 Bug: T121310 Change-Id: I796c78aa2b8fd2ee42b646c801a6a51bb634a425 --- M pywikibot/data/api.py M tests/api_tests.py 2 files changed, 4 insertions(+), 3 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/data/api.py b/pywikibot/data/api.py index efbab77..abeafdf 100644 --- a/pywikibot/data/api.py +++ b/pywikibot/data/api.py @@ -3043,9 +3043,11 @@ @rtype: str """ if hasattr(query, 'items'): - query = query.items() + query = list(query.items()) + if PY2: query = [(pair[0], pair[1].encode('utf-8')) for pair in query] + # parameters ending on 'token' should go last # wpEditToken should go very last query.sort(key=lambda x: x[0].lower().endswith('token') + diff --git a/tests/api_tests.py b/tests/api_tests.py index 0b06b80..1cbb9de 100644 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -977,8 +977,7 @@
"""Test url_encode."""
- family = 'wikipedia' - code = 'test' + net = False
def test_url_encoding_from_list(self): """Test moving 'token' parameters from a list to the end."""
pywikibot-commits@lists.wikimedia.org