How to use the bottle.get 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 D-L / SimpleBookMarks / src / calendar_view.py View on Github external
@get('/css/')
def css(filename):
    return static_file(filename, root='static/css/')
github janelia-flyem / NeuTu / neurolabi / python / service / neutuse.py View on Github external
@get('/skeletonize')
def skeletonize():
    response = '''
        <form method="post" action="/skeletonize">
            Body ID: <input type="text" name="bodyId">
            <input type="submit" value="Submit">
            '''
    response += "<select name="\&quot;database\&quot;">"
    for name in sorted(dvidEnvMap):
        response += "<option name="" value="\&quot;&quot;">" + name + "</option>"
    response += "</select>"

    response += "</form>"

    return response
github HackerDom / ructf-2018 / services / eloquent / webserver / service.py View on Github external
@get('/suggestions')
@view('suggestions')
def suggestions():
    if not sm.validate_session():
        redirect('/')
    username = request.get_cookie('login')
    return {
        'login': request.get_cookie('login'),
        'articles': get_article_titles_by_login(username, get_drafts=True)
    }
github tdorssers / ztp / app.py View on Github external
@bottle.get('/csv')
def get_csv():
    """ Converts JSON file to CSV and sends it to web server """
    log(bottle.request)
    with open('data.json') as infile:
        data = json.load(infile, object_pairs_hook=OrderedDict)
        validate(data)
        # Flatten JSON data
        flat_data = []
        for dct in data:
            flat = OrderedDict()
            for k in dct:
                if isinstance(dct[k], OrderedDict):
                    for kk in dct[k]:
                        flat[str(k) + '/' + str(kk)] = dct[k][kk]
                else:
                    flat[k] = dct[k]
github CivicSpleen / ambry / ambry / server / main.py View on Github external
@get('/datasets/')
@CaptureException
def get_dataset(did, library, pid=None):
    """Return the complete record for a dataset, including the schema and all
    partitions."""

    gr = library.get(did)

    if not gr:
        raise exc.NotFound("Failed to find dataset for {}".format(did))

    # Construct the response
    d = {'identity': gr.identity.dict, 'partitions': {}}

    files = library.files.query.installed.ref(gr.identity.vid).all

    # Get direct access to the cache that implements the remote, so
github penguintutor / neopixel-gui / neopixel-server.py View on Github external
@get ('/allon')
def ssl_allon():
    return allon()
github codalab / codalab-worksheets / codalab / rest / account.py View on Github external
@get('/account/css', skip=UserVerifiedPlugin)
def css():
    response.content_type = 'text/css'
    if request.user.is_authenticated:
        return template('user_authenticated_css', username=request.user.user_name)
    else:
        return template('user_not_authenticated_css')
github CivicSpleen / ambry / ambry / server / main.py View on Github external
@get('/datasets')
def get_datasets(library):
    """Return all of the dataset identities, as a dict, indexed by id."""

    from ..orm import Dataset

    return {dsid.cache_key: {
        'identity': dsid.dict,
        'refs': {
            'path': dsid.path,
            'cache_key': dsid.cache_key
            },
        'urls': {
            'partitions': "{}/datasets/{}".format(_host_port(library), dsid.vid),
            'db': "{}/datasets/{}/db".format(_host_port(library), dsid.vid)
        },
        'schema': {
github AcrDijon / henet / henet / views / media.py View on Github external
@get("/media/", no_i18n=True)
def get_file(filename):
    media_dir = app._config['henet']['media_dir']
    fullpath = os.path.join(media_dir, filename)
    mimetype = guess_type(fullpath)[0]

    return static_file(filename, root=media_dir,
                       mimetype=mimetype)