36
36
return _quote(value, safe)
39
def direct_get_account(node, part, account, marker=None, limit=None,
40
prefix=None, delimiter=None, conn_timeout=5,
43
Get listings directly from the account server.
45
:param node: node dictionary from the ring
46
:param part: partition the account is on
47
:param account: account name
48
:param marker: marker query
49
:param limit: query limit
50
:param prefix: prefix query
51
:param delimeter: delimeter for the query
52
:param conn_timeout: timeout in seconds for establishing the connection
53
:param response_timeout: timeout in seconds for getting the response
54
:returns: a tuple of (response headers, a list of containers) The response
55
headers will be a dict and all header names will be lowercase.
60
qs += '&marker=%s' % quote(marker)
62
qs += '&limit=%d' % limit
64
qs += '&prefix=%s' % quote(prefix)
66
qs += '&delimiter=%s' % quote(delimiter)
67
with Timeout(conn_timeout):
68
conn = http_connect(node['ip'], node['port'], node['device'], part,
69
'GET', path, query_string='format=json')
70
with Timeout(response_timeout):
71
resp = conn.getresponse()
72
if resp.status < 200 or resp.status >= 300:
74
raise ClientException(
75
'Account server %s:%s direct GET %s gave status %s' % (node['ip'],
76
node['port'], repr('/%s/%s%s' % (node['device'], part, path)),
78
http_host=node['ip'], http_port=node['port'],
79
http_device=node['device'], http_status=resp.status,
80
http_reason=resp.reason)
82
for header, value in resp.getheaders():
83
resp_headers[header.lower()] = value
84
if resp.status == 204:
86
return resp_headers, []
87
return resp_headers, json_loads(resp.read())
39
90
def direct_head_container(node, part, account, container, conn_timeout=5,
40
91
response_timeout=15):