Revision 0d79eb23
b/kamaki/clients/astakos.py | ||
---|---|---|
40 | 40 |
def __init__(self, base_url, token): |
41 | 41 |
super(AstakosClient, self).__init__(base_url, token) |
42 | 42 |
|
43 |
def raise_for_status(self, r): |
|
44 |
msg = r.text.strip() |
|
45 |
if msg: |
|
46 |
raise ClientError(msg, r.status_code) |
|
47 |
else: |
|
48 |
# Fallback to the default |
|
49 |
super(AstakosClient, self).raise_for_status(r) |
|
50 |
|
|
51 | 43 |
def authenticate(self, token=None): |
44 |
""" |
|
45 |
:param token: (str) custom token to authenticate |
|
46 |
|
|
47 |
:returns: (dict) authentication information |
|
48 |
""" |
|
52 | 49 |
if token: |
53 | 50 |
self.token = token |
54 | 51 |
r = self.get('/im/authenticate') |
Also available in: Unified diff