def get(self): """ Get all available algorithms and associated data """ return jsonify(cm.get_all_algorithms())
from clusterapp import app, api import os from functools import wraps from flask import Flask, render_template ,abort ,jsonify, current_app, redirect, session, request, url_for, flash from flask.ext.restful import reqparse, Resource, marshal_with, fields import json import cluster.models as cm import cluster.application as ca parser = reqparse.RequestParser() for algorithm,data in cm.get_all_algorithms().items(): for p in data["parameters"]: parser.add_argument(p['parameter'], type=cm.ALGORITHM_TYPES[p['param_type']]) parser.add_argument('coords',type=dict,location='json') class ClusterAlgorithms(Resource): def get(self): """ Get all available algorithms and associated data """ return jsonify(cm.get_all_algorithms()) class Cluster(Resource): def post(self,**kwargs):