0
我有一個看起來像一個端點: api.add_resource(UserForm,'/app/user/form/<int:form_id>', endpoint='user_form')
瓶:調用類,需要一個資源
我的窗體的樣子:
class UserForm(Resource):
def get(self, form_id):
# GET stuff here
return user_form_dictionary
如果我有一個函數調用get_user_form(form_id)和我想要根據傳入的form_id參數從UserForm的get方法中獲取返回值。Flask中有一種方法允許某種方式在程序中調用UserForm的get方法嗎?
def get_user_form(form_id):
user_form_dictionary = # some way to call UserForm class
# user_form_dictionary will store return dictionary from
# user_form_dictionary, something like: {'a': 'blah', 'b': 'blah'}