def DELETE(self):
input_data = web.data()
data = urlparse.parse_qs(input_data)
v_ct_fids = db.query("select distinct a.value from t_ci_attribute a where a.endtime = $endtime and a.family_id = $fid ",vars={'endtime':ENDTIME,'fid':data['fid'][0]})
json_en = demjson.encode(v_ct_fids)
json_de = demjson.decode(json_en)
v_ct_fid_num = len(json_de)
if v_ct_fid_num == 0:
return 2 #there are no records to delete in table T_CI_ATTRIBUTE
elif v_ct_fid_num > 1:
return 3 #there are more than one records to delete in table T_CI_ATTRIBUTE
v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
#delete t_ci_attribute
n = fn_delete_ciattr(data['fid'][0],v_curtime,data['change_log'][0])
return n
python类data()的实例源码
def DELETE(self):
input_data = web.data()
data = urlparse.parse_qs(input_data)
v_ct_fids = db.query("SELECT distinct c.name FROM t_ci_attribute_type c WHERE c.family_id = $fid and c.endtime = $endtime",vars={'fid':data['fid'][0],'endtime':ENDTIME})
json_en = demjson.encode(v_ct_fids)
json_de = demjson.decode(json_en)
v_ct_fid_num = len(json_de)
if v_ct_fid_num == 0:
return 2 #There are no records to delete in table t_ci_attribute_type
elif v_ct_fid_num > 1:
return 3 #There are more than one records to delete in table t_ci_attribute_type
v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
#When deleting t_ci_attribute_type, we should delete all the relative attribute
n = fn_delete_ci_attrtype(data['fid'][0],v_curtime,data['change_log'][0])
return n
def GET(self, scope, name):
""" List all parents of a data identifier.
HTTP Success:
200 OK
HTTP Error:
401 Unauthorized
500 InternalError
:returns: A list of dictionary containing all dataset information.
"""
header('Content-Type', 'application/x-json-stream')
try:
for dataset in list_parent_dids(scope=scope, name=name):
yield render_json(**dataset) + "\n"
except DataIdentifierNotFound, error:
raise generate_http_error(404, 'DataIdentifierNotFound', error.args[0][0])
except RucioException, error:
raise generate_http_error(500, error.__class__.__name__, error.args[0][0])
except Exception, error:
print format_exc()
raise InternalError(error)
def GET(self):
#??????
data = web.input()
signature=data.signature
timestamp=data.timestamp
nonce=data.nonce
echostr=data.echostr
#???token
token="YourToken" #????????????????token
#?????
list=[token,timestamp,nonce]
list.sort()
sha1=hashlib.sha1()
map(sha1.update,list)
hashcode=sha1.hexdigest()
#sha1????
#??????????????echostr
if hashcode == signature:
return echostr
def GET(self):
#??????
data = web.input()
signature=data.signature
timestamp=data.timestamp
nonce=data.nonce
echostr = data.echostr
#???token
token="wxpytest" #????????????????token
#?????
list=[token,timestamp,nonce]
list.sort()
sha1=hashlib.sha1()
map(sha1.update,list)
hashcode=sha1.hexdigest()
#sha1????
#??????????????echostr
if hashcode == signature:
return echostr
def GET(self, params):
result = None
headers = self._get_headers()
target_url = '/' +params
if web.ctx.environ.get('QUERY_STRING', None):
target_url += '?'+web.ctx.environ['QUERY_STRING']
httpcon = httplib.HTTPConnection('twitter.com', 80)
try:
httpcon.request('GET', target_url, headers=headers)
twitter_response = httpcon.getresponse()
return self.sendoutput(twitter_response)
except Exception, inst:
if result:
logger.error("%s\n\n%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data(), twitter_response.read()))
else:
logger.error("%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data()))
web.internalerror()
def POST(self, gateway, params):
result = None
if gateway not in picture_gateways:
gateway = 'twitpic'
ghost, gport, gbaseurl = picture_gateways[gateway]
target_url = '/' +params
headers = self._get_headers()
httpcon = httplib.HTTPConnection(ghost, gport)
#logger.debug(str(headers))
#logger.debug(web.data())
try:
httpcon.request('POST', target_url, headers=headers, body=web.data())
twitter_response = httpcon.getresponse()
return self.sendoutput(twitter_response)
except Exception, inst:
if result:
logger.error("%s\n\n%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data(), twitter_response.read()))
else:
logger.error("%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, web.data()))
web.internalerror()
def POST(self, gateway, params):
result = None
if gateway not in picture_gateways:
gateway = 'twitpic'
ghost, gport, gbaseurl = picture_gateways[gateway]
target_url = '/'+params
headers = self._get_headers()
httpcon = httplib.HTTPConnection(ghost, gport)
#logger.debug(str(headers))
#logger.debug(web.data())
try:
httpcon.request('POST', gbaseurl+'api/upload', headers=headers, body=web.data())
twitter_response = httpcon.getresponse()
return self.sendoutput(twitter_response)
except Exception, inst:
if result:
logger.error("%s\n\n%s\n\n%s\n\n%s" % (target_url, str(inst), headers, twitter_response.read()))
else:
logger.error("%s\n\n%s\n\n%s" % (target_url, str(inst), headers))
web.internalerror()
def POST(self, o_type):
web.header('Access-Control-Allow-Origin', self.allow_origin)
web.header('Access-Control-Allow-Headers', "Content-type")
data = web.data()
payload = {}
try:
payload = ast.literal_eval(data)
if type(payload) != dict:
payload = ast.literal_eval(json.loads(data))
except:
return "malformed json body"
client_session_id = uuid.uuid4().hex
out = ""
if o_type == 'a':
out = self.INDEX_HTML%(client_session_id, payload) + \
self.INDEX_HTML_TYPE_A + \
self.INDEX_HTML_END
elif o_type == 'b':
out = self.INDEX_HTML%(client_session_id, payload) + \
self.INDEX_HTML_TYPE_B + \
self.INDEX_HTML_END
return out
def POST(self, machine):
web.header('Access-Control-Allow-Origin', self.allow_origin)
data = web.data()
payload = {}
try:
payload = ast.literal_eval(data)
if type(payload) != dict:
payload = ast.literal_eval(json.loads(data))
except:
return "malformed json body"
try:
command = payload['command']
except:
out = "you must specify a command"
return out
try:
cmd = "/usr/local/bin/docker-machine ssh "+machine+" \""+command+"\""
out = subprocess.check_output(cmd, shell=True)
except:
out = "unable to execute generic command"
return str(out)
def POST(self):
web.header('Access-Control-Allow-Origin', self.allow_origin)
web.header('Access-Control-Allow-Headers', "Content-type")
# !! TODO does this work with swagger?
data = web.data()
payload = {}
try:
payload = ast.literal_eval(data)
if type(payload) != dict:
payload = ast.literal_eval(json.loads(data))
except Exception as e:
return "malformed json body", str(e)
try:
filedir = '/tmp/templates/'+payload['machine']
if not os.path.exists(filedir):
os.makedirs(filedir)
cmd = "docker-machine scp "+payload['machine']+":/var/lib/docker/data/templates/"+payload['template']+" "+filedir
output = subprocess.check_output(cmd, shell=True)
f = open(filedir+"/"+payload['template'], 'rb')
return f.read()
except Exception as e:
return "failed to download", str(e)
return "failed to download", str(e)
def POST():
"""
Send a POST request with a docker container ID and it will be stopped.
Example input: {'id': "12345"}, {'id': ["123", "456"]
"""
web.header('Content-Type', 'application/json')
# verify user input
data = web.data()
payload = {}
try:
payload = ast.literal_eval(data)
except Exception as e: # pragma: no cover
return (False, 'malformed payload : ' + str(e))
# verify payload has a container ID
if 'id' not in payload:
return (False, 'payload missing container id')
# connect to docker and stop the given container
c = None
try:
c = docker.from_env()
except Exception as e: # pragma: no cover
return (False, 'unable to connect to docker because: ' + str(e))
# stop containers chosen from CLI
try:
for container_id in payload['id']:
c.containers.get(container_id).stop()
except Exception as e: # pragma: no cover
return (False, 'unable to stop list of containers because: ' +
str(e))
return (True, 'container successfully stopped: ' + str(payload['id']))
def POST():
"""
Send a POST request with a docker container ID and it will be deleted.
Example input: {'id': "12345"}, {'id': ["123", "456"]}
"""
web.header('Content-Type', 'application/json')
# verify user input
data = web.data()
payload = {}
try:
payload = ast.literal_eval(data)
except Exception as e: # pragma: no cover
return (False, 'malformed payload : ' + str(e))
# verify payload has a container ID
if 'id' not in payload:
return (False, 'payload missing container id')
# connect to docker and stop the given container
c = None
try:
c = docker.from_env()
except Exception as e: # pragma: no cover
return (False, 'unable to connect to docker because: ' + str(e))
# delete containers chosen from CLI
try:
for container_id in payload['id']:
c.containers.get(container_id).remove()
except Exception as e: # pragma: no cover
return (False, 'unable to delete containers because: '
+ str(e))
return (True, 'container successfully deleted: ' + str(payload['id']))
def POST():
"""
Send a POST request with a docker container ID and it will be started.
Example input: {'id': "12345"}, {'id': ["123", "456"]}
"""
web.header('Content-Type', 'application/json')
# verify user input
data = web.data()
payload = {}
try:
payload = ast.literal_eval(data)
except Exception as e: # pragma: no cover
return (False, 'malformed payload : ' + str(e))
# verify payload has a container ID
if 'id' not in payload:
return (False, 'payload missing container id')
# connect to docker and stop the given container
c = None
try:
c = docker.from_env()
except Exception as e: # pragma: no cover
return (False, 'unable to connect to docker because: ' + str(e))
# start containers chosen from CLI
try:
for container_id in payload['id']:
c.containers.get(container_id).start()
except Exception as e: # pragma: no cover
return (False, 'unable to start list of containers because: ' +
str(e))
return (True, 'container successfully started: ' + str(payload['id']))
def GET(self, url):
r = requests.get(server+url, data=web.input(), headers=web_headers)
print 'text = ', r.text
return r.text
def POST(self, url):
r = requests.post(server+url, data=web.data(), headers=web.headers)
print 'text = ', r.text
return r.text
def POST(self):
global modelCache
params = json.loads(web.data())
requestInput = web.input()
id = requestInput["id"]
# We will always return the active cells because they are cheap.
returnSnapshots = [TM_SNAPS.ACT_CELLS]
from pprint import pprint; pprint(params)
tm = TM(**params)
tmFacade = TmFacade(tm, ioClient, modelId=id)
modelId = tmFacade.getId()
modelCache[modelId]["tm"] = tmFacade
modelCache[modelId]["classifier"] = SDRClassifierFactory.create(implementation="py")
modelCache[modelId]["recordsSeen"] = 0
print "Created TM {}".format(modelId)
payload = {
"meta": {
"id": modelId,
"saving": returnSnapshots
}
}
tmState = tmFacade.getState(*returnSnapshots)
for key in tmState:
payload[key] = tmState[key]
web.header("Content-Type", "application/json")
return json.dumps(payload)
def POST(self):
"""Respond to inbound webhook JSON HTTP POSTs from Cisco Spark."""
json_data = web.data() # Get the POST data sent from Spark
print("\nWEBHOOK POST RECEIVED:")
print(json_data, "\n")
webhook_obj = Webhook(json_data) # Create a Webhook object from the JSON data
room = api.rooms.get(webhook_obj.data.roomId) # Get the room details
message = api.messages.get(webhook_obj.data.id) # Get the message details
person = api.people.get(message.personId) # Get the sender's details
print("NEW MESSAGE IN ROOM '{}'".format(room.title))
print("FROM '{}'".format(person.displayName))
print("MESSAGE '{}'\n".format(message.text))
# This is a VERY IMPORTANT loop prevention control step.
# If you respond to all messages... You will respond to the messages
# that the bot posts and thereby create a loop condition.
me = api.people.me()
if message.personId == me.id:
# Message was sent by me (bot); do not respond.
return 'OK'
else:
# Message was sent by someone else; parse message and respond.
if "/CAT" in message.text:
print("FOUND '/CAT'")
cat_fact = get_catfact() # Get a cat fact
print("SENDING CAT FACT '{}'".format(cat_fact))
response_message = api.messages.create(room.id, text=cat_fact) # Post the fact to the room where the request was received
return 'OK'
def getclient(data):
client = data
client = client.split("\"Player\":")
client = client[1]
client = client.split("},")
client = client[0]
client = client.split("title\":\"")
client = client[1]
client = client.split("\"")
client = client[0]
return (client)
def getaction(data):
action = data
action = action.split("event\":\"")
action = action[1]
action = action.split("\"")
action = action[0]
return action
def DELETE(self):
input_data = web.data()
data = urlparse.parse_qs(input_data)
v_ct_fids = db.query("SELECT distinct c.name FROM t_ci_type c WHERE c.family_id = $fid and c.endtime = $endtime",
vars={'fid':data['fid'][0],'endtime':ENDTIME})
json_en = demjson.encode(v_ct_fids)
json_de = demjson.decode(json_en)
v_ct_fid_num = len(json_de)
if v_ct_fid_num == 0:
return 2 #there are no records to delete in table T_CI_TYPE
elif v_ct_fid_num > 1:
return 3 #there are more than one records to delete in table T_CI_TYPE
#Before deleting t_ci_type, we should ensure that there are no relative records in t_ci?t_ci_attribute_type?t_ci_relation_type
v_num = db.query('select count(*) num from t_ci a where a.type_fid = $fid and a.endtime = $endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
ci_num = v_num[0]['NUM']
if ci_num <> 0:
return 4 #there are relative records in t_ci
# If there is no relative ci, there will be no relative attribute and relation. Then we can directly delete attribute type and relation type
# Delete ci_attribute_type
v_cat_fids = db.query('select distinct a.family_id from t_ci_attribute_type a where a.ci_type_fid = $fid and a.endtime = $endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
json_en = demjson.encode(v_cat_fids)
json_de = demjson.decode(json_en)
v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
v_ct_fid_num = len(json_de)
if v_ct_fid_num <> 0:
for v_cat_fid in json_de:
n = webci_attr_type.fn_delete_ci_attrtype(v_cat_fid['FAMILY_ID'], v_curtime, data['change_log'][0])
#Delete ci_relation_type
v_crt_fids = db.query('select distinct a.family_id from t_ci_relation_type a where (a.source_type_fid = $fid or a.target_type_fid = $fid) and a.endtime = $endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
json_en = demjson.encode(v_crt_fids)
json_de = demjson.decode(json_en)
v_ct_fid_num = len(json_de)
if v_ct_fid_num <> 0:
for v_crt_fid in json_de:
n = webci_relation_type.fn_delete_ci_relatype(v_crt_fid['FAMILY_ID'], v_curtime, data['change_log'][0])
#Delete t_ci_type
n = fn_delete_ci_type(data['fid'][0],v_curtime,data['change_log'][0])
return n
def DELETE(self):
input_data = web.data()
data = urlparse.parse_qs(input_data)
v_ct_fids = db.query('SELECT distinct c.name FROM t_ci c WHERE c.family_id = $fid and c.endtime=$endtime',vars={'fid':data['fid'][0],'endtime':ENDTIME})
json_en = demjson.encode(v_ct_fids)
json_de = demjson.decode(json_en)
v_ct_fid_num = len(json_de)
if v_ct_fid_num == 0:
return 2 #there are no records to delete in table t_ci
elif v_ct_fid_num > 1:
return 3 #there are more than one records to delete in table t_ci
#Notice?besides t_ci?information in t_ci_attribute and t_ci_relation should be deleted too
v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
n = fn_delete_ci(data['fid'][0],v_curtime,data['change_log'][0])
return n
def DELETE(self):
input_data = web.data()
data = urlparse.parse_qs(input_data)
v_ct_fids = db.query("select distinct t.source_fid,t.target_fid,t.type_fid,t.owner,t.family_id from t_ci_relation t where t.family_id=$fid and t.endtime=$endtime",vars={'endtime':ENDTIME,'fid':data['fid'][0]})
json_en = demjson.encode(v_ct_fids)
json_de = demjson.decode(json_en)
v_ct_fid_num = len(json_de)
if v_ct_fid_num == 0:
return 2 #there is no records to delete in table T_CI_RELATION
elif v_ct_fid_num > 1:
return 3 #there are more than one records to delete in table T_CI_RELATION
v_curtime = time.strftime("%Y%m%d%H%M%S", time.localtime())
#Notice?if the relation is composition and the target ci exists, we should delete the relative ci
v_target_fids = db.query("select t.family_id, crt.relation from t_ci t, t_ci_relation_type crt where t.family_id=$target_fid and t.endtime=$endtime and crt.family_id=$type_fid and crt.endtime=$endtime and crt.relation='COMPOSITION'",vars={'endtime':ENDTIME,'target_fid':json_de[0]['TARGET_FID'],'type_fid':json_de[0]['TYPE_FID']})
target_json_en = demjson.encode(v_target_fids)
target_json_de = demjson.decode(target_json_en)
v_target_num = len(target_json_de)
if v_target_num <> 0:
#delete the existed ci. It will also delete the relative ci_attribute and ci_relation.
n = webci.fn_delete_ci(json_de[0]['TARGET_FID'], v_curtime, data['change_log'][0])
else:
#delete t_ci_relation
n = fn_delete_cirela(data['fid'][0],v_curtime,data['change_log'][0])
return n
def PUT(self, account):
""" update the status for a given account name
HTTP Success:
200 OK
HTTP Error:
401 Unauthorized
404 Not Found
500 InternalError
"""
json_data = data()
try:
parameter = loads(json_data)
except ValueError:
raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary')
status = parameter.get('status', 'ACTIVE')
try:
set_account_status(account, status=status, issuer=ctx.env.get('issuer'))
except ValueError:
raise generate_http_error(400, 'ValueError', 'Unknown status %s' % status)
except AccessDenied, e:
raise generate_http_error(401, 'AccessDenied', e.args[0][0])
except AccountNotFound, e:
raise generate_http_error(404, 'AccountNotFound', e.args[0][0])
except Exception, e:
raise InternalError(e)
raise OK()
def DELETE(self, account):
""" Delete an account's identity mAPPing.
HTTP Success:
200 Created
HTTP Error:
400 Bad Reqeust
401 Unauthorized
404 Not Found
500 Internal Error
:param account: Account identifier.
"""
json_data = data()
try:
parameter = loads(json_data)
except ValueError:
raise generate_http_error(400, 'ValueError', 'cannot decode json parameter dictionary')
try:
identity = parameter['identity']
authtype = parameter['authtype']
except KeyError, e:
if e.args[0] == 'authtype' or e.args[0] == 'identity':
raise generate_http_error(400, 'KeyError', '%s not defined' % str(e))
except TypeError:
raise generate_http_error(400, 'TypeError', 'body must be a json dictionary')
try:
del_account_identity(identity, authtype, account)
except AccessDenied, e:
raise generate_http_error(401, 'AccessDenied', e.args[0][0])
except AccountNotFound, e:
raise generate_http_error(404, 'AccountNotFound', e.args[0][0])
except IdentityError, e:
raise generate_http_error(404, 'IdentityError', e.args[0][0])
except Exception, e:
print format_exc()
raise InternalError(e)
raise OK()
def PUT(self, rule_id):
"""
Update the replication rules locked flag .
HTTP Success:
200 OK
HTTP Error:
401 Unauthorized
404 Not Found
500 InternalError
"""
json_data = data()
try:
params = loads(json_data)
options = params['options']
update_replication_rule(rule_id=rule_id, options=options, issuer=ctx.env.get('issuer'))
except AccessDenied as error:
raise generate_http_error(401, 'AccessDenied', error.args[0][0])
except RuleNotFound as error:
raise generate_http_error(404, 'RuleNotFound', error.args[0][0])
except AccountNotFound as error:
raise generate_http_error(404, 'AccountNotFound', error.args[0][0])
except ScratchDiskLifetimeConflict as error:
raise generate_http_error(409, 'ScratchDiskLifetimeConflict', error.args[0])
except ValueError:
raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
except UnsupportedOperation as error:
raise generate_http_error(409, 'UnsupportedOperation', error.args[0])
except RucioException as error:
raise generate_http_error(500, error.__class__.__name__, error.args[0])
raise OK()
def DELETE(self, rule_id):
"""
Delete a new replication rule.
HTTP Success:
200 OK
HTTP Error:
401 Unauthorized
404 Not Found
500 Internal Error
"""
json_data = data()
try:
purge_replicas = None
params = loads(json_data)
if 'purge_replicas' in params:
purge_replicas = params['purge_replicas']
except ValueError:
raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
try:
delete_replication_rule(rule_id=rule_id, purge_replicas=purge_replicas, issuer=ctx.env.get('issuer'))
except AccessDenied as error:
raise generate_http_error(401, 'AccessDenied', error.args[0][0])
except UnsupportedOperation as error:
raise generate_http_error(401, 'UnsupportedOperation', error.args[0][0])
except RuleNotFound as error:
raise generate_http_error(404, 'RuleNotFound', error.args[0][0])
except Exception, error:
raise InternalError(error)
raise OK()
def PUT(self, account, name):
"""
Update an existing subscription.
HTTP Success:
201 Created
HTTP Error:
400 Bad Request
401 Unauthorized
404 Not Found
500 Internal Error
"""
json_data = data()
try:
params = loads(json_data)
params = params['options']
except ValueError:
raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
metadata = {}
metadata['filter'] = params.get('filter', None)
metadata['replication_rules'] = params.get('replication_rules', None)
metadata['comments'] = params.get('comments', None)
metadata['lifetime'] = params.get('lifetime', None)
metadata['retroactive'] = params.get('retroactive', None)
metadata['priority'] = params.get('priority', None)
try:
update_subscription(name=name, account=account, metadata=metadata, issuer=ctx.env.get('issuer'))
except (InvalidObject, TypeError) as error:
raise generate_http_error(400, 'InvalidObject', error[0][0])
except AccessDenied as error:
raise generate_http_error(401, 'AccessDenied', error.args[0][0])
except SubscriptionNotFound as error:
raise generate_http_error(404, 'SubscriptionNotFound', error[0][0])
except RucioException as error:
raise generate_http_error(500, error.__class__.__name__, error.args[0])
except Exception as error:
raise InternalError(error)
raise Created()
def POST(self):
"""
Create file replicas at a given RSE.
HTTP Success:
201 Created
HTTP Error:
401 Unauthorized
409 Conflict
500 Internal Error
"""
json_data = data()
try:
parameters = parse_response(json_data)
except ValueError:
raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
try:
add_replicas(rse=parameters['rse'], files=parameters['files'], issuer=ctx.env.get('issuer'), ignore_availability=parameters.get('ignore_availability', False))
except InvalidPath, e:
raise generate_http_error(400, 'InvalidPath', e.args[0][0])
except AccessDenied, e:
raise generate_http_error(401, 'AccessDenied', e.args[0][0])
except Duplicate, e:
raise generate_http_error(409, 'Duplicate', e[0][0])
except DataIdentifierAlreadyExists, e:
raise generate_http_error(409, 'DataIdentifierAlreadyExists', e[0][0])
except RSENotFound, e:
raise generate_http_error(404, 'RSENotFound', e[0][0])
except ResourceTemporaryUnavailable, e:
raise generate_http_error(503, 'ResourceTemporaryUnavailable', e[0][0])
except RucioException, e:
raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
except Exception, e:
print format_exc()
raise InternalError(e)
raise Created()
def PUT(self):
"""
Update a file replicas state at a given RSE.
HTTP Success:
200 OK
HTTP Error:
401 Unauthorized
500 Internal Error
"""
json_data = data()
try:
parameters = parse_response(json_data)
except ValueError:
raise generate_http_error(400, 'ValueError', 'Cannot decode json parameter list')
try:
update_replicas_states(rse=parameters['rse'], files=parameters['files'], issuer=ctx.env.get('issuer'))
except AccessDenied, e:
raise generate_http_error(401, 'AccessDenied', e.args[0][0])
except UnsupportedOperation, e:
raise generate_http_error(500, 'UnsupportedOperation', e.args[0][0])
except RucioException, e:
raise generate_http_error(500, e.__class__.__name__, e.args[0][0])
except Exception, e:
print format_exc()
raise InternalError(e)
raise OK()