api: Add default protocol for localhost.
Add default "http://" to site argument locally if it is not specified in an api call. This fixes a problem where if you didn't manually specify `http://` when connecting to a development server, the API bindings would hang trying to connect using HTTPS.
This commit is contained in:
parent
4cdc59a3e4
commit
cac0d1c394
|
@ -213,7 +213,9 @@ class Client(object):
|
||||||
self.email = email
|
self.email = email
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
if site is not None:
|
if site is not None:
|
||||||
if not site.startswith("http"):
|
if site.startswith("localhost"):
|
||||||
|
site = "http://" + site
|
||||||
|
elif not site.startswith("http"):
|
||||||
site = "https://" + site
|
site = "https://" + site
|
||||||
# Remove trailing "/"s from site to simplify the below logic for adding "/api"
|
# Remove trailing "/"s from site to simplify the below logic for adding "/api"
|
||||||
site = site.rstrip("/")
|
site = site.rstrip("/")
|
||||||
|
|
Loading…
Reference in a new issue