3

Has anybody been able to get URL path variables working with Google Cloud Functions written in Python?

Using Flask directly, it's pretty trivial:

@app.route('/user/<username>')
def show_user_profile(username):
    return 'User %s' % escape(username)

But Google Cloud Functions don't seem to recognize that it needs to pass the "username" param to the function call. Instead, GCF always seems to pass Flask's "Request" object to the function call.

Flask also allows you to access path variables with Request.view_args but that doesn't seem to work on GCP either. It comes in empty.

Has anyone else tried this?

3
  • This may be a duplicate:stackoverflow.com/questions/53488766/… Commented Feb 5, 2020 at 21:40
  • That has to do with having multiple routes. I’m looking for processing variables within the path. Commented Feb 5, 2020 at 21:51
  • 1
    This one links to the same one, and outlines variables in their url path: stackoverflow.com/questions/59299377/…. Commented Feb 5, 2020 at 22:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.