Commit 5690a5fc authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Add method "get_endpoint_url" in AstakosClient

Refs: #2

In kamaki, AstakosClient is imported from the astakosclient
package, and then it is wrapped so that some convenienve methods
can be added.
parent 783ab58b
......@@ -68,7 +68,10 @@ class AstakosClient(OriginalAstakosClient):
def get_service_endpoints(self, service_type, version=None):
services = parse_endpoints(
self.get_endpoints(), ep_type=service_type, ep_version_id=version)
return services[0]['endpoints'][0] if services else []
return services[0]['endpoints'][0] if services else {}
def get_endpoint_url(self, service_type, version=None):
return self.get_service_endpoints(service_type, version)['publicURL']
def user_info(self):
......@@ -252,6 +255,10 @@ class CachedAstakosClient(Client):
return matches[0]
def get_endpoint_url(self, service_type, version=None, token=None):
r = self.get_service_endpoints(service_type, version, token)
return r['publicURL']
def list_users(self):
"""list cached users information"""
if not self._cache:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment