Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Get querystrings

I am struggling to get the authentication parameters from an external system that return the token via a call to my page with querystring parameter. Such as:

http://mysiteurl?ticket=qjoijfe1239hfnlkh10344lknvf1049u

How do I get the ticket value ?

Using this callback

@app.callback(Output(‘page-content’, ‘children’),
Input(‘url’, ‘pathname’))
def display_page(pathname):
print(‘pathname=’,pathname)

I get the called page in my site but without the full URL or without the querystring.

Thanks

Sorry, I just found that is very easy using instead of

…Input(‘url’, ‘pathname’))

but

Input(‘url’, ‘href’))

Then using

print(request.args) you get the url.

The while callback would be:


@app.callback(Output(‘page-content’, ‘children’),
Input(‘url’, ‘href’))
def display_page(pathname):
print(‘pathname=’,pathname)

# ... inside app.callback ... 
print(request.args)

. . .

I write so others may look for it.