@app.route('/notes', methods=['POST', 'PUT'])
def add_note():
 id_token = request.headers['Authorization'].split(' ').pop()
 claims = google.oauth2.id_token.verify_firebase_token(id_token, HTTP_REQUEST)
 if (not claims):
  return ('Unauthorized', 401)
 data = request.get_json()
 note = Note(parent=ndb.Key(Note, claims['sub']), message=data['message'])
 note.friendly_id = claims.get('name', claims.get('email', 'Unknown'))
 note.put()
 return ('OK', 200)

@ app . route ( '/notes' , methods = [ 'POST' , 'PUT' ] ) def add_note ( ) : id_token = request . headers [ 'Authorization' ] . split ( ' ' ) . pop ( ) claims = google . oauth2 . id_token . verify_firebase_token ( id_token , HTTP_REQUEST ) if ( not claims ) : return ( 'Unauthorized' , 401 ) data = request . get_json ( ) note = Note ( parent = ndb . Key ( Note , claims [ 'sub' ] ) , message = data [ 'message' ] ) note . friendly_id = claims . get ( 'name' , claims . get ( 'email' , 'Unknown' ) ) note . put ( ) return ( 'OK' , 200 )
adds a note to the users notebook .