python mock接口例子

@emm_api.route('/poster', methods=['GET'])
@login_required()
@api_wrap
def get_poster():
    if not has_permission(GBM_EMM_CUSTOM_LIST):
        return APIResult(sc.E_AUTH, msg='用户未被授权')

    mobile = request.mobile
    name = request.name

    d_mock = {
        "iv_code": "c0449bca5e6f11e8ab820242ac11002b",
        "user_id": request.user_id,
        "name": request.name,
        "mobile": request.mobile,
        "url": "http://192.168.4.252:15203/fundinfos/product_detail?prod_type=D&fund_code=270001",
        "img": "https://pic.igesafe.com/licai/image/03c42916f8be11ea91b20242ac110002.jpg?_=1600330558507",
    }
    ret = d_mock
    return APIResult(sc.E_SUCC, result=ret)

 

posted @ 2020-09-21 09:24  第十一个程序员  阅读(119)  评论(0编辑  收藏  举报