Skip to content

Commit 4926010

Browse files
committed
handle locations and projects
1 parent 99c028b commit 4926010

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/actinia/actinia.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,13 @@ def __request_locations(self):
148148
raise Exception("Authentication is not set.")
149149

150150
url = f"{self.url}/locations"
151-
loc_names = request_and_check(
151+
loc_response = request_and_check(
152152
"GET", url, **{"timeout": self.timeout, "auth": (self.__auth)}
153-
)["locations"]
153+
)
154+
loc_names = loc_response.get("locations") or loc_response.get("projects")
155+
if not loc_names:
156+
raise Exception("Authentication is not set.")
157+
154158
loc = {
155159
lname: Location(lname, self, self.__auth) for lname in loc_names
156160
}

0 commit comments

Comments
 (0)