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")
评论列表
文章目录