@app.before_request
def before_request():
    stream_id = None
    user = None
    if 'X-Stream-ID' in request.headers:
        stream_id = request.headers['X-Stream-ID']
        if stream_id in rtc.users:
            user = rtc.users[stream_id]
    setattr(request, 'stream_id', stream_id)
    setattr(request, 'webrtc_user', user)
dataset/ETHPy150Open chalasr/Flask-P2P/app.py/before_request/original