/usr/lib/python2.7/dist-packages/acix/core/indexclient.py is in nordugrid-arc-acix-core 5.4.2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | """
Client for retrieving cache. Note that json is only available on python >= 2.6.
"""
import json
from urllib import quote
from twisted.python import log
from twisted.web import client
class InvalidIndexReplyError(Exception):
pass
def queryIndex(index_url, urls):
for url in urls: assert ',' not in urls, "Commas ',' not allowed in urls currently"
eurls = [ quote(url) for url in urls ]
url = index_url + "?url=" + ','.join(eurls)
d = client.getPage(url)
d.addCallback(_gotResult, index_url)
d.addErrback(_indexError, index_url)
return d
def _gotResult(result, index_url):
log.msg("Got reply from index service %s" % index_url)
try:
decoded_result = json.loads(result)
return decoded_result
except ValueError, e:
raise InvalidIndexReplyError(str(e))
def _indexError(failure, index_url):
log.msg("Error while getting index results:")
log.err(failure)
return failure
|