jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/356432 )
Change subject: MWSite.__init__: Re-raise the RequestException of _parse_post_117
......................................................................
MWSite.__init__: Re-raise the RequestException of _parse_post_117
If there is any kind of RequestException in _parse_post_117, it means
that the `private_wiki` attribute has not had a chance to be set and
will definitly cause AttributeError later in the code.
Raising the RequestException is more clear and will allow the related
test to be skipped.
Bug: T160355
Change-Id: I75eb7c35a1e030a309bdf271a7ddc8ac69052ab9
---
M pywikibot/site_detect.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py
index d4bf878..347bd63 100644
--- a/pywikibot/site_detect.py
+++ b/pywikibot/site_detect.py
@@ -13,6 +13,8 @@
import json
import re
+from requests import RequestException
+
import pywikibot
from pywikibot.comms.http import fetch
@@ -82,7 +84,7 @@
if self.api:
try:
self._parse_post_117()
- except ServerError:
+ except (ServerError, RequestException):
raise
except Exception as e:
pywikibot.log('MW 1.17+ detection failed: {0!r}'.format(e))
--
To view, visit https://gerrit.wikimedia.org/r/356432
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I75eb7c35a1e030a309bdf271a7ddc8ac69052ab9
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/353705 )
Change subject: Update documentation on inside-tags exceptions for replace.py
......................................................................
Update documentation on inside-tags exceptions for replace.py
The definition of the exceptions changed and was moved. (Old fixes
from compat seem to be incompatible, too.)
Change-Id: I3cdfa2ede29933e4dc3c641816716ae2703e5d6b
---
M scripts/replace.py
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/replace.py b/scripts/replace.py
index 7b5c952..d0784ea 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -524,7 +524,8 @@
regular expressions.
inside-tags
A list of strings. These strings must be keys from the
- exceptionRegexes dictionary in textlib.replaceExcept().
+ dictionary in textlib._create_default_regexes() or must be
+ accepted by textlib._get_regexes().
@type exceptions: dict
@param allowoverlap: when matches overlap, all of them are replaced.
--
To view, visit https://gerrit.wikimedia.org/r/353705
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3cdfa2ede29933e4dc3c641816716ae2703e5d6b
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Nemo bis <federicoleva(a)tiscali.it>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/356129 )
Change subject: [IMPR] Make socket_timeout recalculation reusable
......................................................................
[IMPR] Make socket_timeout recalculation reusable
On older installations of requests it's not possible to use two timeout values
but newer versions may have two: one for the connection one for read timeout.
To ensure the right value depending on the requests version there was a fix
inside http.py; this should be moved to the upper library place to be
reusable by other library scripts like rcstreams or eventstreams.
config2.py:
- Since requests > 2.4.1 is required with T134647 for pwb now
the default socket_timeout may be a tuple again. Use new values for it.
- fix the socket_timeout to a single value dependig on
requests version but use the higher of the two values.
Remove warning because labs is still using older requests version 2.2.1.
- http.py:
remove the socket_timeout fixer which was transfered to config2.py.
Bug: T166539
Change-Id: I598ac9fa2fa4f237b68d44bd8cf3c587d5768bd1
---
M pywikibot/comms/http.py
M pywikibot/config2.py
2 files changed, 13 insertions(+), 10 deletions(-)
Approvals:
Dalba: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py
index bbf20b3..e889975 100644
--- a/pywikibot/comms/http.py
+++ b/pywikibot/comms/http.py
@@ -14,7 +14,7 @@
from __future__ import absolute_import, print_function, unicode_literals
#
-# (C) Pywikibot team, 2007-2016
+# (C) Pywikibot team, 2007-2017
#
# Distributed under the terms of the MIT license.
#
@@ -25,7 +25,6 @@
import atexit
import sys
-from distutils.version import StrictVersion
from string import Formatter
from warnings import warn
@@ -69,13 +68,6 @@
SSL_CERT_VERIFY_FAILED_MSG = 'certificate verify failed'
_logger = "comm.http"
-
-if (isinstance(config.socket_timeout, tuple) and
- StrictVersion(requests.__version__) < StrictVersion('2.4.0')):
- warning('The configured timeout is a tuple but requests does not '
- 'support a tuple as a timeout. It uses the lower of the '
- 'two.')
- config.socket_timeout = min(config.socket_timeout)
def mode_check_decorator(func):
diff --git a/pywikibot/config2.py b/pywikibot/config2.py
index 78898cc..8c2ddeb 100644
--- a/pywikibot/config2.py
+++ b/pywikibot/config2.py
@@ -50,7 +50,11 @@
import sys
import types
+from distutils.version import StrictVersion
from locale import getdefaultlocale
+
+from requests import __version__ as requests_version
+
from warnings import warn
from pywikibot.logging import error, output, warning
@@ -782,7 +786,7 @@
# DO NOT set to None to disable timeouts. Otherwise this may freeze your script.
# You may assign either a tuple of two int or float values for connection and
# read timeout, or a single value for both in a tuple (since requests 2.4.0).
-socket_timeout = 75
+socket_timeout = (6.05, 45)
# ############# COSMETIC CHANGES SETTINGS ##############
@@ -1128,6 +1132,13 @@
"Defaulting to family='test' and mylang='test'.")
family = mylang = 'test'
+# Fix up socket_timeout
+# Older requests library expect a single value whereas newer versions also
+# accept a tuple (connect timeout, read timeout).
+if (isinstance(socket_timeout, tuple) and
+ StrictVersion(requests_version) < StrictVersion('2.4.0')):
+ socket_timeout = max(socket_timeout)
+
# SECURITY WARNINGS
if (not ignore_file_security_warnings and
private_files_permission & (stat.S_IRWXG | stat.S_IRWXO) != 0):
--
To view, visit https://gerrit.wikimedia.org/r/356129
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I598ac9fa2fa4f237b68d44bd8cf3c587d5768bd1
Gerrit-PatchSet: 9
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Magul <tomasz.magulski(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>