Allow a protocol in the http.base_url parameter (#5557)

pull/5045/merge
Robbie Trencheny 2017-01-26 21:43:45 -08:00 committed by Paulus Schoutsen
parent 3f2fdb97a0
commit 295a232374
1 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,9 @@ class API(object):
self.port = port
self.api_password = api_password
if use_ssl:
if host.startswith(("http://", "https://")):
self.base_url = host
elif use_ssl:
self.base_url = "https://{}".format(host)
else:
self.base_url = "http://{}".format(host)