Python Pyorient查询到Json
我将OrientDB与Python3.5结合使用,并为我的记录创建了一个API。问题是我得到了这些记录,但我需要序列化这些记录 这是我的密码Python Pyorient查询到Json,python,python-3.x,orientdb,Python,Python 3.x,Orientdb,我将OrientDB与Python3.5结合使用,并为我的记录创建了一个API。问题是我得到了这些记录,但我需要序列化这些记录 这是我的密码 from flask import Flask, request from flask_restful import reqparse, abort, Api, Resource import pyorient app = Flask(__name__) api = Api(app) client = pyorient.OrientDB("localho
from flask import Flask, request
from 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 to enable the token based
client.db_open( "intera", "admin", "admin" )
### store this token somewhere
sessionToken = client.get_session_token()
### destroy the old client, equals to another user/socket/ip ecc.
del client
### create a new client
client = pyorient.OrientDB("localhost", 2424)
### set the previous obtained token to re-attach to the old session
client.set_session_token( sessionToken )
### now the dbOpen is not needed to perform database operations
### set the flag again to true if you want to renew the 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 * from my_class")
api.add_resource(TodoList,'/todos')
if __name__ == '__main__':
app.run(debug =True)
如何修复该错误并序列化这些记录