jenkins-bot submitted this change.

View Change


Approvals: Matěj Suchánek: Looks good to me, approved jenkins-bot: Verified
[cleanup] Deprecate Family.maximum_GET_length() method

Bug: T325957
Change-Id: I921a1da2b03a849d5c4a308b2a1b3725619104d1
---
M pywikibot/family.py
M pywikibot/data/api/_requests.py
2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/pywikibot/data/api/_requests.py b/pywikibot/data/api/_requests.py
index d840b9a..a4d2f6c 100644
--- a/pywikibot/data/api/_requests.py
+++ b/pywikibot/data/api/_requests.py
@@ -658,9 +658,10 @@
use_get = False # MIME requests require HTTP POST
else:
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
- if (not self.site.maximum_GET_length()
- or self.site.maximum_GET_length() < len(paramstring)):
+ if (not config.maximum_GET_length
+ or config.maximum_GET_length < len(paramstring)):
use_get = False
+
if use_get:
uri = f'{uri}?{paramstring}'
body = None
diff --git a/pywikibot/family.py b/pywikibot/family.py
index 981250b..22b83fc 100644
--- a/pywikibot/family.py
+++ b/pywikibot/family.py
@@ -597,8 +597,13 @@
'Found multiple matches for URL "{}": {}'
.format(url, ', '.join(str(s) for s in matched_sites)))

+ @deprecated('config.maximum_GET_length', since='8.0.0')
def maximum_GET_length(self, code):
- """Return the maximum URL length for GET instead of POST."""
+ """Return the maximum URL length for GET instead of POST.
+
+ .. deprecated:: 8.0
+ Use :ref:`config.maximum_GET_length<Account Settings>` instead.
+ """
return config.maximum_GET_length

def dbName(self, code) -> str:

To view, visit change 872417. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I921a1da2b03a849d5c4a308b2a1b3725619104d1
Gerrit-Change-Number: 872417
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Matěj Suchánek <matejsuchanek97@gmail.com>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged