0

I am using flask_api to build a simple web application, however I get a TypeError.

Here is my code:

user.py:

#!/usr/bin/env python
from flask.ext.api import FlaskAPI
from flask import request, url_for

class User_operations(object):

    def login_v(self):
        return 'hello'  

app.py:

#!/usr/bin/env python
from flask.ext.api import FlaskAPI
from user import User_operations

app = FlaskAPI(__name__)
bj = User_operations()

@app.route('/example/',methods=['GET', 'POST'])
def example():
    bj.login_v()

if __name__ == "__main__":
  app.run(debug=True)

This gives me the error:

"TypeError: 'NoneType' object is not callable"
Forge
  • 6,538
  • 6
  • 44
  • 64
Vishnu
  • 56
  • 1
  • 12

1 Answers1

0

In your view function example you are missing the return statement:

@app.route('/example/',methods=['GET', 'POST'])
def example():
  return bj.login_v()
Forge
  • 6,538
  • 6
  • 44
  • 64