Pin requests>=2.4.1 and remove weird version check

This commit is contained in:
Markus Unterwaditzer 2016-03-05 20:03:06 +01:00
parent 81b56ac5d3
commit 949c568852
2 changed files with 8 additions and 27 deletions

View file

@ -20,8 +20,14 @@ requirements = [
'click>=5.0',
'click-log>=0.1.3',
'click-threading>=0.1.2',
# https://github.com/kennethreitz/requests/issues/2930
'requests >=2.0.1, !=2.9.0',
# !=2.9.0: https://github.com/kennethreitz/requests/issues/2930
# >=2.4.1: https://github.com/shazow/urllib3/pull/444
#
# Without the above pull request, `verify=False` also disables fingerprint
# validation. This is *not* what we want, and it's not possible to replicate
# vdirsyncer's current behavior (verifying fingerprints without verifying
# against CAs) with older versions of urllib3.
'requests >=2.4.1, !=2.9.0',
'lxml >=3.1' + (
# See https://github.com/untitaker/vdirsyncer/issues/298
# We pin some LXML version that is known to work with PyPy

View file

@ -8,28 +8,6 @@ from .. import exceptions, log
logger = log.get(__name__)
def _verify_fingerprint_works():
try:
from pkg_resources import parse_version as ver
return ver(requests.__version__) >= ver('2.4.1')
except Exception:
return False
# https://github.com/shazow/urllib3/pull/444
#
# Without the above pull request, `verify=False` also disables fingerprint
# validation. This is *not* what we want, and it's not possible to replicate
# vdirsyncer's current behavior (verifying fingerprints without verifying
# against CAs) with older versions of urllib3.
#
# We check this here instead of setup.py, because:
# - Python's packaging stuff doesn't check installed versions.
# - The people who don't use `verify_fingerprint` wouldn't care.
VERIFY_FINGERPRINT_WORKS = _verify_fingerprint_works()
del _verify_fingerprint_works
def _install_fingerprint_adapter(session, fingerprint):
prefix = 'https://'
try:
@ -65,9 +43,6 @@ def request(method, url, session=None, latin1_fallback=True,
session = requests.Session()
if verify_fingerprint is not None:
if not VERIFY_FINGERPRINT_WORKS:
raise RuntimeError('`verify_fingerprint` can only be used with '
'requests versions >= 2.4.1')
_install_fingerprint_adapter(session, verify_fingerprint)
func = session.request