Modifying the fastapi router is complex to carry out from a streamsync application because it is isolated in a subprocess. The streamsync application sees a copy of the fastapi object. Changes are not taken into account.
import streamsync as ss
@ss.serve.get('/auth/callback')
def route(state, context):
state['username'] = 'fabien'
Using redirection
import streamsync as ss
@ss.serve.get('/auth/callback')
def route(state, context):
state['username'] = 'fabien'
state.open_url('http://www.google.fr')
Using context
import streamsync as ss
@ss.serve.get('/auth/callback')
def route(state, context):
request = context.request
state['username'] = 'fabien'
state.open_url('http://www.google.fr')
Modifying the fastapi router is complex to carry out from a streamsync application because it is isolated in a subprocess. The streamsync application sees a copy of the fastapi object. Changes are not taken into account.
Using redirection
Using context