def run(message): if request.environ.get('wsgi.websocket'): print utils.get_hidden_session('device') device_type = utils.get_hidden_session('device')['type'] from airypi import errors try: event_loop_class = device.Device.event_loop_for_type[device_type] event_loop = event_loop_class() while True: event_loop.loop() gevent.sleep(0) except errors.ExitError, e: print traceback.format_exc() pass
def id(): return utils.get_hidden_session('device')['id']
def decorated_function(*args, **kwargs): if request.headers.get('Authorization') != utils.get_hidden_session('auth_token'): return "invalid auth token", 403 return f(*args, **kwargs)
def decorated_function(*args, **kwargs): if utils.get_hidden_session('user_id') is None: return redirect(url_for('login', next=request.url)) return f(*args, **kwargs)
def decorated_function(*args, **kwargs): if utils.get_hidden_session('user_id') is None: print "not authenticated" return disconnect() return f(*args, **kwargs)
def get_oauth_token(): return utils.get_hidden_session('oauth')