Hello there I am beginner in python and I am getting this error when calling api on my local machine 'localhost'
from flask import Flask,request
from flask_restful import Resource,Api
app = Flask(__name__)
api = Api(app)
todos = {}
class HelloWorld(Resource):
def get(self):
return 'Hello, World War 3'
class Todo(Resource):
def get(self, todo_id):
return {todo_id: todos[todo_id]}
def put(self,todo_id):
todos[todo_id] : request.form['data']
return {todo_id: todos[todo_id]}
api.add_resource(HelloWorld,'/')
api.add_resource(Todo,'/<string:todoId>')
if __name__ == '__main__':
app.run(debug=True)
and Here is the error I am getting while calling this api
raise JSONDecodeError("Expecting
value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Its a pretty small code and yet I am unable to catch the real issue. I am doing as it is on the official site of flask: Flask Site
I have seen other posts on the same issue but they are of high level which I am unable to understand. Any help would be appreciated, thanks