Skip to content

Commit a703035

Browse files
committed
force specification of both endpoints if either specified using signin function
1 parent 9235c9d commit a703035

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/utils.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ end
1717
function signin(username::String, api_key::String, endpoints=None)
1818
# Define session credentials/endpoint configuration, where endpoint is a Dict
1919

20+
global plotlycredentials = PlotlyCredentials(username, api_key)
21+
22+
# if endpoints are specified both the base and api domains must be specified
2023
if endpoints != None
21-
base_domain = get(endpoints, "plotly_domain", default_endpoints["base"])
22-
api_domain = get(endpoints, "plotly_api_domain", default_endpoints["api"])
23-
global plotlyconfig = PlotlyConfig(base_domain, api_domain)
24+
try
25+
base_domain = endpoints["plotly_domain"]
26+
api_domain = endpoints["plotly_api_domain"]
27+
global plotlyconfig = PlotlyConfig(base_domain, api_domain)
28+
catch
29+
error("You must specify both the base and api endpoints.")
30+
end
2431
end
25-
global plotlycredentials = PlotlyCredentials(username, api_key)
2632
end
2733

2834
function get_credentials()

0 commit comments

Comments
 (0)