views.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Startup-Fairy 作者: cs373gc-fall-2016 项目源码 文件源码
def api_financialorgs(entity=None):
    """
    api route for financial org
    :param entity: is the id of a financial org or None
    :return: json with results or 404
    """
    try:
        finorg_id = request.args.get('id')
        if entity is None and finorg_id is None:
            return get_all_from_category(FinancialOrg)
        else:
            if entity is not None:
                data = db.session.query(FinancialOrg).filter_by(
                    financial_org_id=entity).one()
            else:
                data = db.session.query(FinancialOrg).filter_by(
                    financial_org_id=finorg_id).one()
        return json.dumps(data.dictionary())
    except SQLAlchemyError:
        print("Get financial orgs failed")
        abort(404)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号