Пример #1
0
 def get_url(self, service_name, account_id=None):
     try:
         response = self._session.get(
             Region.get_endpoint_url(self._global_endpoint_url,
                                     service_name, account_id
                                     or self.account_id, self.residency))
         response.raise_for_status()
     except requests.exceptions.HTTPError as e:
         raise AuthenticationException(
             f"invalid http response from endpoints service {e}")
     return "https://{}".format(response.json()[service_name])
Пример #2
0
 def get_url(self, service_name, account_id=None):
     if self._global_endpoint == 'aesolo':  # Does not support residency
         return self._global_endpoint_url
     if self._global_endpoint == "map":
         return self.get_mapped_url(service_name, account_id)
     try:
         response = self.request(
             'get',
             Region.get_endpoint_url(self._global_endpoint_url,
                                     service_name, account_id
                                     or self.account_id, self.residency),
         )
         response.raise_for_status()
     except requests.exceptions.HTTPError as e:
         raise AuthenticationException(
             f"invalid http response from endpoints service {e}")
     return "https://{}".format(response.json()[service_name])