Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions bitcoin/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,14 @@ def __init__(self,
self.__service_url = service_url
self.__url = urlparse.urlparse(service_url)

if self.__url.scheme not in ('http',):
if self.__url.scheme not in ('http', 'https'):
raise ValueError('Unsupported URL scheme %r' % self.__url.scheme)

if self.__url.port is None:
port = httplib.HTTP_PORT
if self.__url.scheme == 'https':
port = httplib.HTTPS_PORT
else:
port = httplib.HTTP_PORT
else:
port = self.__url.port
self.__id_count = 0
Expand All @@ -223,8 +226,12 @@ def __init__(self,
if connection:
self.__conn = connection
else:
self.__conn = httplib.HTTPConnection(self.__url.hostname, port=port,
timeout=timeout)
if self.__url.scheme == 'https':
self.__conn = httplib.HTTPSConnection(self.__url.hostname, port=port,
timeout=timeout)
else:
self.__conn = httplib.HTTPConnection(self.__url.hostname, port=port,
timeout=timeout)

def _call(self, service_name, *args):
self.__id_count += 1
Expand Down