From e43303bba7a671b383016d29f55fd03aa0df235b Mon Sep 17 00:00:00 2001 From: Huang Le <4tarhl@gmail.com> Date: Sun, 29 Jun 2014 22:46:59 +0800 Subject: [PATCH] Remove the "strict" parameter of http.client for Python 3.4+ compatability Signed-off-by: Huang Le <4tarhl@gmail.com> --- bitcoinrpc/authproxy.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bitcoinrpc/authproxy.py b/bitcoinrpc/authproxy.py index d2ccff3..60d00ef 100644 --- a/bitcoinrpc/authproxy.py +++ b/bitcoinrpc/authproxy.py @@ -38,6 +38,7 @@ import http.client as httplib except ImportError: import httplib +import sys import base64 import json import decimal @@ -89,12 +90,18 @@ def __init__(self, service_url, service_name=None, timeout=HTTP_TIMEOUT, connect # Callables re-use the connection of the original proxy self.__conn = connection elif self.__url.scheme == 'https': - self.__conn = httplib.HTTPSConnection(self.__url.hostname, port, - None, None, False, - timeout) + if sys.version_info < (3, 4): + self.__conn = httplib.HTTPSConnection(self.__url.hostname, port, + None, None, False, timeout) + else: + self.__conn = httplib.HTTPSConnection(self.__url.hostname, port, + None, None, timeout) else: - self.__conn = httplib.HTTPConnection(self.__url.hostname, port, - False, timeout) + if sys.version_info < (3, 4): + self.__conn = httplib.HTTPConnection(self.__url.hostname, port, + False, timeout) + else: + self.__conn = httplib.HTTPConnection(self.__url.hostname, port, timeout) def __getattr__(self, name): if name.startswith('__') and name.endswith('__'):