the following is my code for get method:
def get(self, ques_no, i):
j=i
opt_dict = {}
for ques in session.query(Options.optn).filter(Options.q_no == ques_no)[j:j+2]:
opt_dict.update({i:ques.optn})
i=i+1
return jsonify(opt_dict)
api.add_resource(store_option, '/option/&&', endpoint = 'option_id')
i need to pass to arguments to my get method to access the database. but i'm not able pass to arguments. how can i do that?? any help will be appreciated..
From modifying my own code, something like this should work.
Start by defining a class like this:
class DBAccessor(Resource):
def put(self, ques_no, i):
...
return 'ok'
Now connect it like this:
app = Flask('wasp')
api = Api(app)
api.add_resource(
DBAccessor,
'/option/<ques_no>/<i>')