def api_send_loves():
sender = request.form.get('sender')
recipients = sanitize_recipients(request.form.get('recipient'))
message = request.form.get('message')
try:
recipients = send_loves(recipients, message, sender_username=sender)
recipients_display_str = ', '.join(recipients)
link_url = create_love_link(recipients_display_str, message).url
return make_response(
u'Love sent to {}! Share: {}'.format(recipients_display_str, link_url),
LOVE_CREATED_STATUS_CODE,
{}
)
except TaintedLove as exc:
return make_response(
exc.user_message,
LOVE_FAILED_STATUS_CODE if exc.is_error else LOVE_CREATED_STATUS_CODE,
{}
)
评论列表
文章目录