0

using flask, how can i print the url path that is been assign to my function form the decorator @route with out having to do the request from internet.

example:

@app.route('/hello')
def hello():
    """
    the hello function
    @documentation
    :return: string
    """
    return 'Hello, World!'

i want to be able to do:

hello.__doc__ = "This is the path to the function:" +  the_full_URL_assigned_form_@app.route

at the end should look like this

hello.__doc__ = "This is the path to the function: /hello" 
pelos
  • 1,744
  • 4
  • 24
  • 34
  • see https://stackoverflow.com/questions/21498694/flask-get-current-route – balderman Mar 29 '21 at 17:21
  • thanks, but that only happen when you run the app and call the function by internet, is there a way to get the full path of the route? with out having to run the app? and call the url? thats what "request" pass to the application – pelos Mar 29 '21 at 17:42
  • See https://julien.danjou.info/python-ast-checking-method-declaration/ – balderman Mar 29 '21 at 18:04

0 Answers0