api.py 文件源码

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

项目:sms-proxy 作者: flowroute 项目源码 文件源码
def list_proxy_sessions():
    """
    The ProxySession resource endpoint for listing ProxySessions
    from the pool.
    """
    sessions = ProxySession.query.all()
    res = [{
        'id': s.id,
        'date_created': s.date_created.strftime('%Y-%m-%d %H:%M:%S'),
        'virtual_tn': s.virtual_TN,
        'participant_a': s.participant_a,
        'participant_b': s.participant_b,
        'expiry_date': s.expiry_date.strftime('%Y-%m-%d %H:%M:%S')
        if s.expiry_date else None}
        for s in sessions]
    return Response(
        json.dumps({"total_sessions": len(res), "sessions": res}),
        content_type="application/json")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号