def post(self):
try:
parser = reqparse.RequestParser()
parser.add_argument('metaseek_ids', type=str)
args = parser.parse_args()
metaseek_ids = json.loads(args['metaseek_ids'])
#check if the number of ids you're looking up is below an acceptable threshold; otherwise return error
if len(metaseek_ids)>user_n_threshold:
return {'error':'you are trying to get metadata for too many datasets at once. Please query the database for '+str(user_n_threshold)+' or fewer datasets at a time'}
else:
queryObject = filterQueryByRule(Dataset,Dataset.query,'id',8,metaseek_ids)
result = marshal(queryObject.all(), fullDatasetFields)
return {"count_matching_datasets":len(result), "datasets":result}
except Exception as e:
return {'error': str(e)}
# End route functions
# Declare routing
评论列表
文章目录