def endpoint(): width = int(request.values.get('M')) height = int(request.values.get('N')) liveCells = [] i = 0 liveCells = parseQuery(str(request.query_string)) return jsonpify(output=conway(width, height, liveCells))
def run_hooks(): id = request.values.get('id') jwt = request.values.get('jwt') if jwt is None: abort(403) if id is None: abort(400) return jsonpify(controllers.run_hooks(id, jwt))
def get(self): parser = reqparse.RequestParser() parser.add_argument('callback', required=False) args = parser.parse_args() callback = args['callback'] res = model.sofiguers() resp = make_response(jsonpify(Resault=res)) return resp
def upload_status(): datapackage = request.values.get('datapackage') if datapackage is None: abort(400) ret = controllers.upload_status(datapackage, cache_get) if ret is None: abort(404) return jsonpify(ret)
def run_hooks(): id = request.values.get('id') jwt = request.values.get('jwt') pipeline = request.values.get('pipeline') if jwt is None: abort(403) if pipeline is None or id is None: abort(400) return jsonpify(controllers.run_hooks(id, jwt, pipeline))
def get(self): parser = reqparse.RequestParser() parser.add_argument('callback', required=False) args = parser.parse_args() callback = args['callback'] mydict = models.Run_Forecast_PIP() #return mydict if (callback is None): return jsonify(ForecastPipeline=mydict) if (callback is not None): return jsonpify(ForecastPipeline=mydict)
def upload(): jwt = request.values.get('jwt') datapackage = request.values.get('datapackage') if datapackage is None: abort(400) if jwt is None: abort(403) ret = controllers.upload(datapackage, jwt, cache_get, cache_set) return jsonpify(ret)
def __call__(self): datapackage = request.values.get('datapackage') if datapackage is None: abort(400) key = 'os-conductor:apiload:'+datapackage ret = cache.get(key) if ret is None: abort(404) return jsonpify(ret)
def get(self): parser = reqparse.RequestParser() parser.add_argument('version', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() version = args['version'] callback = args['callback'] res = model.sodashbacklockedshort(version) resp = make_response(jsonpify(Resault=res)) return resp
def get(self): parser = reqparse.RequestParser() parser.add_argument('gtype', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() gtype = args['gtype'] callback = args['callback'] res = model.graphs(gtype) resp = make_response(jsonpify(Resault=res)) return resp
def get(self): parser = reqparse.RequestParser() parser.add_argument('alert', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() alert = args['alert'] callback = args['callback'] res = model.specialnotifications(alert) resp = make_response(jsonpify(Resault=res)) return resp
def upload(): jwt = request.values.get('jwt') datapackage = request.values.get('datapackage') if datapackage is None: abort(400) if jwt is None: abort(403) callback = 'http://'+os_conductor+url_for('.callback') ret = controllers.upload(datapackage, callback, jwt, cache_set) return jsonpify(ret)
def get(self): parser = reqparse.RequestParser() parser.add_argument('version', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() version = args['version'] callback = args['callback'] res = model.sodashshipmentshort(version) resp = make_response(jsonpify(Resault=res)) resp.headers['Access-Control-Allow-Origin'] = '*' return resp
def upload_status_update(): """Get notified for changes in the package upload status. """ datapackage = request.values.get('package') status = request.values.get('status') error = request.values.get('error') progress = request.values.get('progress', 0) controllers.upload_status_update(datapackage, status, error, progress, cache_get, cache_set) return jsonpify(True)
def update_params(): jwt = request.values.get('jwt') datapackage = request.values.get('id') params = request.get_json() if 'params' not in params or not isinstance(params['params'], str): abort(400, "No 'params' key or bad params value.") if datapackage is None: abort(400) if jwt is None: abort(403) ret = controllers.update_params(datapackage, jwt, params) return jsonpify(ret)
def get(self): parser = reqparse.RequestParser() parser.add_argument('alert', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() alert = args['alert'] callback = args['callback'] res = model.specialnotifications(alert) if (callback is None): return jsonify(Resault=res) if (callback is not None): resp = make_response(jsonpify(Resault=res)) resp.headers['Access-Control-Allow-Origin'] = '*' return resp
def get(self): parser = reqparse.RequestParser() parser.add_argument('gtype', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() gtype = args['gtype'] callback = args['callback'] res = model.graphs(gtype) if (callback is None): return jsonify(Resault=res) if (callback is not None): resp = make_response(jsonpify(Resault=res)) resp.headers['Access-Control-Allow-Origin'] = '*' return resp
def search(kind): token = request.values.get('jwt') userid = None try: if token is not None: token = jwt.decode(token, PRIVATE_KEY) userid = token.get('userid') except jwt.InvalidTokenError: pass ret = search_controller(kind, userid, request.args) if ret is None: abort(400) return jsonpify(ret)
def get(self): parser = reqparse.RequestParser() parser.add_argument('alert', required=False) parser.add_argument('number', required=False) parser.add_argument('version', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() alert = args['alert'] number = args['number'] version = args['version'] callback = args['callback'] res = model.sodashlist(alert, number, version) resp = make_response(jsonpify(Resault=res)) return resp
def get(self): parser = reqparse.RequestParser() parser.add_argument('alert', required=False) parser.add_argument('number', required=False) parser.add_argument('version', required=False) parser.add_argument('callback', required=False) args = parser.parse_args() alert = args['alert'] number = args['number'] version = args['version'] callback = args['callback'] res = model.notifications(alert, number, version) resp = make_response(jsonpify(Resault=res)) resp.headers['Access-Control-Allow-Origin'] = '*' return resp
def get(self): parser = reqparse.RequestParser() parser.add_argument('startdate', required=False) parser.add_argument('enddate', required=False) parser.add_argument('callback', required=False) #res=model.list() args = parser.parse_args() startdate = args['startdate'] enddate = args['enddate'] callback = args['callback'] res = model.list(startdate, enddate) if (callback is None): return jsonify(Resault=res) if (callback is not None): resp = make_response(jsonpify(Resault=res)) resp.headers['Access-Control-Allow-Origin'] = '*' return resp
def toggle_publish(): id = request.values.get('id') jwt = request.values.get('jwt') if jwt is None: abort(403) value = request.values.get('publish', '') value = value.lower() toggle = None publish = None if value == 'toggle': toggle = True else: if value in ['true', 'false']: publish = json.loads(value) if publish is None and toggle is None: return Response(status=400) return jsonpify(controllers.toggle_publish(id, jwt, toggle, publish))
def get(self): # auth = request.headers.get('Authorization', None) # if not auth: # resp = make_response(jsonpify(Resault={{'code': 'authorization_header_missing!!!', 'description': 'Authorization test header is expected'}})) # return resp parser = reqparse.RequestParser() parser.add_argument('callback', required=False) args = parser.parse_args() callback = args['callback'] res = model.sofiguers() resp = make_response(jsonpify(Resault=res)) resp.headers['Access-Control-Allow-Credentials'] = 'true' resp.headers['Access-Control-Allow-Headers'] = ' Authorization' resp.headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS' resp.headers['Access-Control-Allow-Origin'] = '*' return resp
def get(self): try: parser = reqparse.RequestParser() parser.add_argument('callback', required=False) parser.add_argument('cached', required=True) args = parser.parse_args() callback = args['callback'] iscached = args['cached'] if iscached.lower() == 'false': dbmodels.EXPUPDATE.CLEANSFDC7() SFrows = models.Run_Exp_SF4_Cleanup() for row in SFrows: dbmodels.EXPUPDATE.FillSFDC7(row) mydict = dbmodels.EXPUPDATE.SFDC_EXP_DESCREPANCY() if callback is None: return jsonify(DESCREPENCIES=mydict) if callback is not None: resp = make_response(jsonpify(DESCREPENCIES=mydict)) resp.headers['Access-Control-Allow-Origin'] = '*' return resp except Exception as e: return {"ERROR": str(e)}
def __call__(self): datapackage = request.values.get('datapackage') if datapackage is None: abort(400) params = { 'package': datapackage, 'callback': 'http://'+os_conductor+url_for('apiload.callback') } load_url = 'http://'+os_api+'/api/3/loader/' response = requests.get(load_url, params=params) if response.status_code == 200: key = 'os-conductor:apiload:'+datapackage ret = { "progress": 0, "status": "queued" } cache.set(key, ret, 3600) else: ret = { "status": "fail", "error": 'HTTP %s' % response.status_code } return jsonpify(ret)
def check(): token = request.values.get('jwt') service = request.values.get('service') return jsonpify(check_controller(token, service))
def delete_package(): id = request.values.get('id') jwt = request.values.get('jwt') if jwt is None: abort(403) return jsonpify(controllers.delete_package(id, jwt))
def stats(): return jsonpify(controllers.stats())
def get(): array = db_select() return jsonpify(array)
def authorize(): token = request.values.get('jwt') service = request.values.get('service') return jsonpify(authorize_controller(token, service))
def check(): token = request.values.get('jwt') next_url = request.args.get('next', None) return jsonpify( authenticate_controller(token, next_url, get_callback_url()))
def update(): token = request.values.get('jwt') username = request.values.get('username') return jsonpify(update_controller(token, username))
def check(): token = request.values.get('jwt') next_url = request.args.get('next', None) callback_url = 'http://'+os_conductor+url_for('.callback') return jsonpify(check_controller(token, next_url, callback_url))
def search(kind): ret = search_controller(kind, request.args) if ret is None: abort(400) return jsonpify(ret)