Revision 8f2d7ede snf-astakos-client/astakosclient/__init__.py
b/snf-astakos-client/astakosclient/__init__.py | ||
---|---|---|
35 | 35 |
import urlparse |
36 | 36 |
import httplib |
37 | 37 |
import urllib |
38 |
from copy import copy |
|
38 | 39 |
|
39 | 40 |
import simplejson |
40 | 41 |
import objpool.http |
... | ... | |
85 | 86 |
""" |
86 | 87 |
if logger is None: |
87 | 88 |
logger = logging.getLogger("astakosclient") |
88 |
logger.debug("Intialize AstakosClient: astakos_url = %s" |
|
89 |
logger.debug("Intialize AstakosClient: astakos_url = %s, "
|
|
89 | 90 |
"use_pool = %s" % (astakos_url, use_pool)) |
90 | 91 |
|
91 | 92 |
if not astakos_url: |
... | ... | |
129 | 130 |
# ---------------------------------- |
130 | 131 |
@retry |
131 | 132 |
def _callAstakos(self, token, request_path, |
132 |
headers={}, body={}, method="GET"):
|
|
133 |
headers=None, body=None, method="GET"):
|
|
133 | 134 |
"""Make the actual call to Astakos Service""" |
134 | 135 |
self.logger.debug( |
135 | 136 |
"Make a %s request to %s with headers %s " |
... | ... | |
140 | 141 |
m = "Token not given" |
141 | 142 |
self.logger.error(m) |
142 | 143 |
raise ValueError(m) |
144 |
if headers is None: |
|
145 |
headers = {} |
|
146 |
if body is None: |
|
147 |
body = {} |
|
143 | 148 |
|
144 | 149 |
# Build request's header and body |
145 | 150 |
kwargs = {} |
146 |
kwargs['headers'] = headers
|
|
151 |
kwargs['headers'] = copy(headers)
|
|
147 | 152 |
kwargs['headers']['X-Auth-Token'] = token |
148 | 153 |
if body: |
149 |
kwargs['body'] = body
|
|
154 |
kwargs['body'] = copy(body)
|
|
150 | 155 |
kwargs['headers'].setdefault( |
151 | 156 |
'content-type', 'application/octet-stream') |
152 | 157 |
kwargs['headers'].setdefault('content-length', |
Also available in: Unified diff