inbox.py 文件源码

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

项目:two1-python 作者: 21dotco 项目源码 文件源码
def _inbox(config, client):
    """Show a list of notifications on a click pager.

    Args:
        config (Config): config object used for getting .two1 information
        client (two1.server.rest_client.TwentyOneRestClient) an object for
            sending authenticated requests to the TwentyOne backend.

    Returns:
        list: list of notifications in users inbox
    """
    prints = []

    notifications, has_unreads = get_notifications(config, client)
    if not notifications:
        logger.info("Inbox empty")
        return notifications

    if len(notifications) > 0:
        prints.append(uxstring.UxString.notification_intro)
        prints.extend(notifications)

    output = "\n".join(prints)
    logger.info(output, pager=True)

    if has_unreads:
        client.mark_notifications_read(config.username)

    return tuple(map(click.unstyle, notifications))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号