diff --git a/pywikibot/comms/eventstreams.py b/pywikibot/comms/eventstreams.py index df6773f0ae..5e27c6d150 100644 --- a/pywikibot/comms/eventstreams.py +++ b/pywikibot/comms/eventstreams.py @@ -8,16 +8,18 @@ pip install sseclient """ # -# (C) xqt, 2017 -# (C) Pywikibot team, 2017 +# (C) xqt, 2017-2018 +# (C) Pywikibot team, 2017-2018 # # Distributed under the terms of the MIT license. # from __future__ import absolute_import, unicode_literals +from distutils.version import LooseVersion import json import socket +import requests from requests.packages.urllib3.exceptions import ProtocolError from requests.packages.urllib3.response import httplib @@ -29,6 +31,12 @@ from pywikibot import config, debug, Site, warning from pywikibot.tools import StringTypes +if LooseVersion(requests.__version__) < LooseVersion('2.9'): + raise ImportError( + 'requests >= 2.9 is required for EventStreams;\n' + "install it with 'pip install \"requests>=2.9,!=2.18.2\"'\n") + + _logger = 'pywikibot.eventstreams' diff --git a/requests-requirements.txt b/requests-requirements.txt index cd0deff607..6b4eed548c 100644 --- a/requests-requirements.txt +++ b/requests-requirements.txt @@ -1,4 +1,4 @@ -requests>=2.4.1,!=2.18.2 +requests>=2.9,!=2.18.2 # requests security extra # Bug T105767 on Python 2.7 release 9+ diff --git a/requirements.txt b/requirements.txt index cb6d10c8fd..bf40d5264a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ # $ awk -F '[#>=]' '{print $1}' requirements.txt | xargs apt-cache search # mandatory; see README.conversion.txt -requests>=2.4.1,!=2.18.2 +requests>=2.9,!=2.18.2 # requests security extra cryptography>=1.3.4 ; python_version != '2.6' and python_full_version < '2.7.9' diff --git a/setup.py b/setup.py index 92063cb678..81c9e8e8dd 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def python_is_supported(): test_deps = ['bz2file', 'mock'] -dependencies = ['requests!=2.18.2'] +dependencies = ['requests>=2.9,!=2.18.2'] # the irc module has no Python 2.6 support since 10.0 irc_dep = 'irc==8.9' if sys.version_info < (2, 7) else 'irc'