flask api with parameter

args = request.args
print (args) # For debugging
no1 = args['key1']
no2 = args['key2']
return jsonify(dict(data=[no1, no2])) # or whatever is required

Here is what the above code is Doing:
1. The @app.route decorator is used to specify the URL that should trigger our function.
2. The request object is passed to the function by default.
3. The request.args attribute contains a dictionary of all the parameters in the URL.
4. We extract the parameters from the dictionary and store them in variables.
5. We return a JSON response using the jsonify function.