jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/416336 )
Change subject: family.py: Use pywikibot.comms.http.fetch instead of requests.get ......................................................................
family.py: Use pywikibot.comms.http.fetch instead of requests.get
This way the config options such as `socket_timeout` will be applied.
Change-Id: I85cd651161234e1abc6b1e383e206071092adef1 --- M pywikibot/family.py 1 file changed, 3 insertions(+), 4 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py index 4be15e5..00428c2 100644 --- a/pywikibot/family.py +++ b/pywikibot/family.py @@ -25,9 +25,8 @@
from warnings import warn
-import requests - import pywikibot +from pywikibot.comms.http import fetch from pywikibot import config from pywikibot.exceptions import UnknownFamily, FamilyMaintenanceWarning from pywikibot.tools import ( @@ -1296,10 +1295,10 @@ """ # Here we return the latest mw release for downloading if not hasattr(self, '_version'): - self._version = requests.get( + self._version = fetch( 'https://www.mediawiki.org/w/api.php?action=expandtemplates' '&text={{MW_stable_release_number}}&prop=wikitext&format=json' - ).json()['expandtemplates']['wikitext'] + ).data.json()['expandtemplates']['wikitext'] return self._version
def force_version(self, code):
pywikibot-commits@lists.wikimedia.org