1
I need to get the parameters passed by the URI, for example:
http://localhost/endpoint/param1/param2/param3
if param1 == "adduser"
id = param2
name = param3
Example of a function that did not work: search a way to search!!!
from flask import Flask
from flask_restful import Resource, Api, reqparse
app = Flask(__name__)
api = Api(app)
class HelloWorld(Resource):
def post(self):
myargs = {}
for field in ("id","nome"):
myargs[field] = request.form.get(field)
print(myargs["id"].decode("utf-8"))
print(myargs["nome"].decode("utf-8"))
api.add_resource(HelloWorld, '/teste')
if __name__ == '__main__':
app.run(debug=True)