def pressed(): if throttle.check(): log.info('Doorbell pressed') sound.play() pushover.send(config.message_text) thingspeak.update() else: log.info('THROTTLING')
def pasteit(): ip = get_real_ip(request) r = throttle.check(ip) if r is False: abort(401, "Not authorized") codebody = request.POST['codebody'] raw = request.POST.get('raw', None) if codebody is None: abort(500, 'Empty request') a = idgen.request() id = base62_encode(a) r = ds.save("pasteit-%s" % id, codebody) if r is False: abort(503, 'Internal error saving id %s (%d)' % (id, a)) if raw is None: redirect("%s/%s" % (BASE_URL, id)) else: return id