0

I'm writing a Flask+SQLAlchemy app to replace a series of PHP scripts that were developed a long time ago. One of the scripts depends on a number of keys being available on the $_GET variable, like appName. These values are sent by an external app that I cannot control.

What is the best way to capture the key/value pairs set on $_GET from Flask?

1 Answer 1

2

All you really need to do is examine the request object. To extract a variable called "foo" from the request, you would run something similar to this:

request.args.get('foo', '');

This will return the value of the foo parameter, and if it doesn't exist it will return a default empty string (the second parameter to the get function).

Here is the relevant documentation:

Sign up to request clarification or add additional context in comments.

Comments

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.