Revision 43ca98ee kamaki/clients/__init__.py
b/kamaki/clients/__init__.py | ||
---|---|---|
1 |
# Copyright 2011 GRNET S.A. All rights reserved. |
|
1 |
# Copyright 2011-2012 GRNET S.A. All rights reserved.
|
|
2 | 2 |
# |
3 | 3 |
# Redistribution and use in source and binary forms, with or |
4 | 4 |
# without modification, are permitted provided that the following |
... | ... | |
74 | 74 |
|
75 | 75 |
|
76 | 76 |
class Client(object): |
77 |
def __init__(self, base_url, token, include=False, verbose=False):
|
|
77 |
def __init__(self, base_url, token): |
|
78 | 78 |
self.base_url = base_url |
79 | 79 |
self.auth = XAuthTokenAuth(token) |
80 |
self.include = include |
|
81 |
self.verbose = verbose |
|
82 | 80 |
|
83 |
def raise_for_status(self, r): |
|
84 |
if 400 <= r.status_code < 500: |
|
85 |
message, sep, details = r.text.partition('\n') |
|
86 |
elif 500 <= r.status_code < 600: |
|
87 |
message = '%d Server Error' % (r.status_code,) |
|
88 |
details = r.text |
|
89 |
else: |
|
90 |
message = '%d Unknown Error' % (r.status_code,) |
|
91 |
details = r.text |
|
92 |
|
|
93 |
message = message or "HTTP Error %d" % (r.status_code,) |
|
81 |
def raise_for_status(self, r): |
|
82 |
message = "%d %s" % (r.status_code, r.status) |
|
83 |
details = r.text |
|
94 | 84 |
raise ClientError(message, r.status_code, details) |
95 | 85 |
|
96 | 86 |
def request(self, method, path, **kwargs): |
... | ... | |
150 | 140 |
from .storage import StorageClient as storage |
151 | 141 |
from .cyclades import CycladesClient as cyclades |
152 | 142 |
from .pithos import PithosClient as pithos |
143 |
from .astakos import AstakosClient as astakos |
Also available in: Unified diff