How to use the bottle.route function in bottle

To help you get started, we’ve selected a few bottle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github citiususc / stac / api / services.py View on Github external
@route('/friedman///', method=["POST", "OPTIONS"])
@headers
@ranking
def friedman(alpha=0.05, post_hoc="bonferroni_dunn_test", control=None):
    values = clean_missing_values(request.json)
    statistic, p_value, rankings, ranking_cmp = npt.friedman_test(*values.values())
    rankings, names = map(list, zip(*sorted(zip(rankings, values.keys()), key=lambda t: t[0])))
    ranks = {key: ranking_cmp[i] for i,key in enumerate(values.keys())}
    if post_hoc.split('_')[-1] == "test":
        comparisons, z_values, _, adj_p_values = getattr(npt, post_hoc)(ranks, control)
    else:
        comparisons, z_values, _, adj_p_values = getattr(npt, post_hoc)(ranks)
    return statistic, p_value, rankings, names, comparisons, z_values, adj_p_values
github nortd / driveboardapp / backend / web.py View on Github external
@bottle.route('/offset///')
@bottle.auth_basic(checkuser)
@checkserial
def offset(x, y, z):
    if not driveboard.status()['ready']:
        bottle.abort(400, "Machine not ready.")
    driveboard.offset(x, y, z)
    return '{}'
@bottle.route('/offsetx/')
github sjjf / md_server / mdserver / server.py View on Github external
# make sure the path is always properly rooted
        if len(md_base) > 0 and md_base[0] != '/':
            md_base = '/' + md_base
        route(md_base + '/', 'GET', mdh.gen_base)
        route(md_base + '/meta-data/', 'GET', mdh.gen_metadata)
        route(md_base + '/user-data', 'GET', mdh.gen_userdata)
        route(md_base + '/meta-data/hostname', 'GET', mdh.gen_hostname)
        route(md_base + '/meta-data/instance-id', 'GET', mdh.gen_instance_id)
        route(md_base + '/meta-data/public-keys/', 'GET', mdh.gen_public_keys)
        route(md_base + '/meta-data/public-keys//', 'GET',
              mdh.gen_public_key_dir)
        route((md_base + '/meta-data/public-keys//openssh-key'), 'GET',
              mdh.gen_public_key_file)

    # support for uploading instance data
    route('/instance-upload', 'POST', mdh.instance_upload)

    svr_port = app.config.get('mdserver.port')
    listen_addr = app.config.get('mdserver.listen_address')
    run(host=listen_addr, port=svr_port)
github nfvlabs / openmano / openvim / httpserver.py View on Github external
@bottle.route(url_base + '/networks/', method='PUT')
def http_put_network_id(network_id):
    '''update a network_id into the database.'''
    my = config_dic['http_threads'][ threading.current_thread().name ]
    #parse input data
    http_content = format_in( network_update_schema )
    r = remove_extra_items(http_content, network_update_schema)
    change_keys_http2db(http_content['network'], http2db_network)
    network=http_content['network']

    #Look for the previous data
    where_ = {'uuid': network_id}
    result, network_old = my.db.get_table(FROM='nets', WHERE=where_)
    if result < 0:
        print "http_put_network_id error %d %s" % (result, network_old)
        bottle.abort(-result, network_old)
        return
github funcx-faas / funcX / funcx / mock_broker / mock_broker.py View on Github external
@route('/list_mappings')
def list_mappings():
    return request.app.ep_mapping
github facebook / openbmc / meta-facebook / meta-galaxy100 / recipes-utils / rest-api / files / rest.py View on Github external
@route('/api/sys/mb/fruid_scm')
def rest_fruid_scm_hdl():
  return rest_fruid_scm.get_fruid_scm()
github a2tm7a / SMARTHOME / Server / staticFilesForAbout.py View on Github external
@route('/About/images/icons/social/')

def imgs(staticFiles) :

    return static_file(staticFiles , root="/home/pi/Desktop/SMARTHOME/html/ABOUT/images/icons/social")
github ampotos / dynStruct / _dynStruct / web_ui.py View on Github external
@bottle.route("/struct_edit_instance")
def struct_edit_instance():
    struct = _dynStruct.Struct.get_by_id(bottle.request.query.id_struct)

    if not struct:
        return bottle.template("error", msg="Bad struct id")

    return bottle.template("edit_block_list", id_struct=struct.id, struct_name=struct.name)
github shell909090 / sshproxy / web / local.py View on Github external
@bottle.route('/l/cfg')
@chklocal
@utils.jsonenc
def _config():
    r = dict([(k[6:], v) for k, v in app.config.iteritems()
              if k.startswith('proxy.')])
    with open(r['hostkey'], 'rb') as fi: r['hostkey'] = fi.read()
    return r
github warriorframework / warriorframework / katana / katana.py View on Github external
@route('/gotoparentdirectory', method='POST')
def gotoparentdirectory():
    request_json = json.dumps(request.json)
    request_json = json.loads(request_json)
    directory = request_json['directory']
    if directory == "":
        directory = expanduser("~")

    parent_dir = os.path.abspath(os.path.join(directory, os.pardir))
    print parent_dir
    try:
        contents = os.listdir(parent_dir)
        print contents
        files = []
        folders = []
        for i in contents:
            if os.path.isfile(parent_dir + '/' + i):