Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
ins_belt.py 759 Bytes
Copy Edit Web IDE Raw Blame History
Mendalas authored 2019-06-15 16:07 . modify some api
#coding=utf-8
from flask_restful import Resource
from auth import auth
from flask import Flask, abort, request, jsonify, g, url_for
from flask_sqlalchemy import SQLAlchemy
from api import app
import json
from sqlalchemy import and_,or_
import time
import collections
db = SQLAlchemy(app)
class Belt(db.Model):
__tablename__ = 'ins_belt'
belt_id = db.Column(db.Integer, primary_key=True)
des = db.Column(db.String(255))
def to_json(self):
return {
"belt_id":self.belt_id,
"des":self.des
}
class GetBeltInfo(Resource):
def post(self):
result = db.session.query(Belt).all()
v = []
for r in result:
v.append(r.to_json())
app.logger.info(v)
return v

Comment ( 0 )

Sign in for post a comment