Search code examples
pythonweburltornado

how to get current request's url in pywebio


I am using pywebio framework. I want get current request's url in pywebio.

I've tried using pywebio.session.info but no success.

please help me, thanks.


Solution

  • The following eval_js to run a JS code and get the url, e.g.:

    from pywebio.session import eval_js
    
    url = eval_js('window.location.href')
    

    Doc: https://pywebio.readthedocs.io/en/latest/session.html?highlight=eval_js#pywebio.session.eval_js