Пример #1
0
def init(ann_conf, bottle_conf, annotators):
    '''
    Setup and start the servers.
    '''
    # A global variable is needed here because the routes are mapped
    # to top-level functions.
    global ann_manager

    # Pipeline config.
    ann_params = parameters.Params(**ann_conf)
    # Organise logging after basicConfig was called in the Params constructor,
    # but before anything interesting happens (like termlist loading).
    setup_logging()
    # Get the default OGER server.
    ann_manager = AnnotatorManager(ann_params, n=annotators)

    # Bottle: request handling.
    run_bottle(**bottle_conf)
Пример #2
0
def run_server():
    run_bottle(init_app(), host=WEB_HOST, port=WEB_PORT)
Пример #3
0
def run(host='localhost', port=8000):
    "Start the mock HTTP server"
    run_bottle(host=host, port=port, reloader=True)
Пример #4
0
 def run(self) -> None:
     run_bottle(host=self.config.server.host,
                port=self.config.server.port,
                server=self.config.server.engine,
                plugins=[self.logToLogger],
                quiet=True)
Пример #5
0
def run_bridge_server(port=11111):
    # keep the server single threaded so that no locking is necessary
    # around bridge_state
    run_bottle(host='0.0.0.0', port=port, server='paste')
Пример #6
0
def run_bridge_server(port=11111):
    # keep the server single threaded so that no locking is necessary
    # around bridge_state
    run_bottle(host='0.0.0.0', port=port, server='paste')
Пример #7
0
    # find the link
    voting_url = ''
    for link in showlinks():
        if link.url.startswith('vote?for=%s&dir=%s&by=%s' % 
                                (hn_id, vote, username)):
            voting_url = '/' + link.url

    if voting_url == '':
        return abort(code=400, text="Something's wrong at voting, " +
                                    "Could not find the voting url. " +
                                    "Most likely you already voted or " +
                                    "the username or password are wrong.")
    go(voting_url)

    # lets find the login url
    for link in showlinks():
        if link.text == "logout":
            logout_url = link.url

    go(HN_URL)
    go(logout_url)

    # and we're done!
    reset_browser()

    # success! response is always in JSON
    return {'status': "ok", 'message': "voted successfully for %s" % hn_id}

if __name__ == '__main__':
    run_bottle(host='localhost', port=8080)