【问题标题】:Facebook mark notification as read using pythonFacebook 使用 python 将通知标记为已读
【发布时间】:2014-11-03 10:20:49
【问题描述】:

我已经设法读取了 Facebook 通知的未见计数,但想知道是否有办法将通知标记为已读。我正在为 python 使用 Facebook API。我看到有人在此站点上发布了一个链接,但它已过期。

【问题讨论】:

    标签: python facebook-graph-api notifications


    【解决方案1】:

    您应该设置字段:unread=0 以便将通知标记为已读:

    import facebook
    
    graph = facebook.GraphAPI(access_token)
    graph.put_object("notification_id", "", unread=0)
    

    更多信息可以参考:Graph API Doc for norfications

    如果有任何问题,请告诉我。

    【讨论】:

    • 我现在试过了,它没有给我任何错误,但通知仍然显示在我的 Facebook 帐户上未读。
    • 从哪里获得要查看的通知的 id 值?
    • 我使用了以下命令: graph = facebook.GraphAPI(access_token) notifications = graph.get_object("me/notifications") print str(notifications) notifications 具有通知的全部属性,我只是复制 ID 并尝试将其设置为已读。代码得到处理,没有错误,但通知仍未读。
    猜你喜欢
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    • 2017-10-04
    • 2021-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-07
    相关资源
    最近更新 更多