如何获取未收到推送通知的用户列表?

时间:2019-08-07 03:26:54

标签: python firebase push-notification pyfcm

我试图显示失败的用户registration_id,但它显示了所有用户的registration_id。

    push_service = FCMNotification(
        api_key="your_api_key")

    # df = pd.read_excel('/Users/kuanysh/Desktop/dbdemo.xls')
    # registration_ids = df['token'].tolist()
    registration_ids = ["dXopy7d2U54:APA91bHujsltJNhp0E7cA_ZPRSs-Pul5swHG-tWD1ws7GcCVaPZw3HpcGT_eTDbPlQNITue-t4qU2bwBIjZ6t6PU6hLLaMMR0YM-ZU2OuZDR0MrWcp6nca-Xx_E7Gi3MzwFKvgp9igAh","fAthEJwimEU:APA91bGPLimN4TBaCJto1LlzZgjwli2zTFxxhYmeWgZBE08sSRSkG3t1gleS0nIU6p7Gr-vXYVH4Z_H8PMaUtibu4IKmNd5aYxvuA9Vx3a1jyf13B40J9ktuxWIVBx0yXBv-FrCqBBwA"]
    message_title = "Hello"
    message_body = brand + " " + text
    click_action = click_action

    result = push_service.notify_multiple_devices(registration_ids=registration_ids, message_title=message_title,
                                                  message_body=message_body, click_action=click_action)
    for fail in result['results']:
        if fail.get('error') == 'NotRegistered':
            print(registration_ids)
    print(result)

[2019-08-07 09:19:18,364: WARNING/ForkPoolWorker-2] ['first_reg_id', 'second_reg_id']```[2019-08-07 09:19:18,365: WARNING/ForkPoolWorker-2]{'multicast_ids': [7107650407856582362], 'success': 1, 'failure': 1, 'canonical_ids': 0, 'results': [{'message_id': '1565147957873997'}, {'error': 'NotRegistered'}], 'topic_message_id': None}

0 个答案:

没有答案