Ejemplo n.º 1
0
def make_access_log(app, filepath, when='d', interval=7, **kwargs):
    if filepath is not None:
        handlers = [logging.handlers.TimedRotatingFileHandler(
        filepath, when, interval, **kwargs)]
    else:
        handlers = [logging.StreamHandler()]
    return requestlogger.WSGILogger(app, handlers, requestlogger.ApacheFormatter())
Ejemplo n.º 2
0
builderscon.initialize()

import hooks
import filters
import logging
import oauth  # always load AFTER builderscon.initialize
import requestlogger
import sys

# silence pyflakes
assert hooks
assert filters

api = builderscon.api
app = requestlogger.WSGILogger(builderscon.app,
                               [logging.StreamHandler(sys.stdout)],
                               requestlogger.ApacheFormatter())
cache = builderscon.cache
cfg = builderscon.cfg
LANGUAGES = builderscon.LANGUAGES


def github_oauth():
    return oauth.start(oauth.github,
                       builderscon.app.base_url + '/login/github/callback')


def facebook_oauth():
    return oauth.start(oauth.facebook,
                       builderscon.app.base_url + '/login/facebook/callback')
Ejemplo n.º 3
0
            p.join(timeout)
            # If thread is still active
            if p.is_alive():
                p.terminate()
                p.join()
                return bottle.HTTPError(408, "Timeout while processing the function")
            else:
                res = q.get()
                if isinstance(res, Exception):
                    raise res
                return res

@app.get('/healthz')
def healthz():
    return 'OK'

@app.get('/metrics')
def metrics():
    bottle.response.content_type = prom.CONTENT_TYPE_LATEST
    return prom.generate_latest(prom.REGISTRY)

if __name__ == '__main__':
    import logging
    import sys
    import requestlogger
    loggedapp = requestlogger.WSGILogger(
        app,
        [logging.StreamHandler(stream=sys.stdout)],
        requestlogger.ApacheFormatter())
    bottle.run(loggedapp, server='cherrypy', host='0.0.0.0', port=func_port)