@@ -193,12 +193,28 @@ def _post(self, url, auth=None, headers=None, data=None, cookies=None):
193193 return response
194194
195195 def _url (self , path ):
196- if self ._tenant_scoped is True and self ._tenant is not None and self ._tenant != "system" :
197- self ._host = self ._tenant + "." + self ._host
198- # generate tenant scoped token
199- os .path .join ("/" , self ._tenant , path )
200- # ToDo:Region+system scoped tokens will be added once implementation details are finalized in multi-cell
201- # else:
196+ if self ._tenant_scoped is True :
197+ if self ._tenant is None :
198+ raise ValueError ("Tenant is empty." )
199+ elif self ._region is None :
200+ raise ValueError ("Region is empty." )
201+ elif "token" in path and self ._tenant != "system" :
202+ self ._host = self ._tenant + "." + self ._host
203+ # generate tenant scoped token
204+ path = "/" + self ._tenant + path
205+ elif "token" in path and self ._tenant == "system" :
206+ self ._host = "region-" + self ._region + "." + self ._host
207+ # generate system scoped token
208+ path = "/system" + path
209+ elif "authorize" in path and self ._tenant != "system" :
210+ self ._host = self ._tenant + "." + self ._host
211+ elif "authorize" in path and self ._tenant == "system" :
212+ self ._host = "region-" + self ._region + "." + self ._host
213+ elif "csrfToken" in path :
214+ self ._host = "region-" + self ._region + "." + self ._host
215+ elif "authn" in path :
216+ self ._host = "region-" + self ._region + "." + self ._host
217+
202218 print ("https://%s%s" % (self ._host , path ))
203219 return "https://%s%s" % (self ._host , path )
204220
0 commit comments