python - Pyorient query To Json -
i'm using orientdb python 3.5 , create api records. problem got records need serialize these records.
here code.
from flask import flask, request flask_restful import reqparse, abort, api, resource import pyorient app = flask(__name__) api = api(app) client = pyorient.orientdb("localhost", 2424) client.set_session_token( true ) # set true enable token based client.db_open( "intera", "admin", "admin" ) ### store token somewhere sessiontoken = client.get_session_token() ### destroy old client, equals user/socket/ip ecc. del client ### create new client client = pyorient.orientdb("localhost", 2424) ### set previous obtained token re-attach old session client.set_session_token( sessiontoken ) ### dbopen not needed perform database operations ### set flag again true if want renew token client.set_session_token( true ) # set true client.db_open( "intera", "admin", "admin" ) new_sessiontoken = client.get_session_token() assert sessiontoken != new_sessiontoken class todolist(resource): def get(self): query = client.command("select * my_class") api.add_resource(todolist,'/todos') if __name__ == '__main__': app.run(debug =true)
how can fix error , serialize these records.
Comments
Post a Comment