Revision 9d3cd179 kamaki/clients/astakos/__init__.py
b/kamaki/clients/astakos/__init__.py | ||
---|---|---|
31 | 31 |
# interpreted as representing official policies, either expressed |
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 |
from kamaki.clients import Client, ClientError |
|
35 | 34 |
from logging import getLogger |
35 |
from json import dumps |
|
36 |
|
|
37 |
from kamaki.clients import Client, ClientError |
|
38 |
from kamaki.clients.utils import path4url |
|
36 | 39 |
|
37 | 40 |
|
38 | 41 |
class AstakosClient(Client): |
... | ... | |
151 | 154 |
def user_term(self, key, token=None): |
152 | 155 |
"""Get (cached) term, from user credentials""" |
153 | 156 |
return self.user_info(token).get(key, None) |
157 |
|
|
158 |
def post_user_catalogs(self, uuids): |
|
159 |
"""POST base_url/user_catalogs |
|
160 |
|
|
161 |
:param uuids: (list or tuple) user uuids |
|
162 |
|
|
163 |
:returns: (dict) {uuid1: name1, uuid2: name2, ...} |
|
164 |
""" |
|
165 |
account_url = self.get_service_endpoints('account')['publicURL'] |
|
166 |
account = AstakosClient(account_url, self.token) |
|
167 |
json_data = dict(uuids=uuids) |
|
168 |
return account.post('user_catalogs', json=json_data) |
Also available in: Unified diff