python - django推送通知抛出gcm错误
问题描述
我正在使用 django 推送通知,但有时会收到以下错误
raised unexpected: GCMError({'multicast_id': 1826728239203974173, 'success': 4, 'failure': 1, 'canonical_ids': 0, 'results': [{'message_id': '0:1605278994023650%0f493ae6f9fd7ecd'}, {'message_id': '0:1605278994028849%2fd9afcdf9fd7ecd'}, {'error': 'InternalServerError'}, {'message_id': '0:1605278994038573%0f493ae6f9fd7ecd'}, {'message_id': '0:1605278994030881%cc9b4facf9fd7ecd'}]},)
Traceback (most recent call last):
File "/home/project/server-side/.venv/lib/python3.6/site-packages/celery/app/trace.py", line 374, in trace_task
R = retval = fun(*args, **kwargs)
File "/home/project/server-side/.venv/lib/python3.6/site-packages/celery/app/trace.py", line 629, in __protected_call__
return self.run(*args, **kwargs)
File "/home/project/server-side/app/tasks.py", line 299, in alarm_users
is_business_app=True,
File "/home/project/server-side/tools/utils.py", line 246, in send_push
web_devices.send_message(None, extra=kwargs, use_fcm_notifications=True)
File "/home/project/server-side/.venv/lib/python3.6/site-packages/push_notifications/models.py", line 73, in send_message
r = gcm_send_message(reg_ids, data, cloud_type, application_id=app_id, **kwargs)
File "/home/project/server-side/.venv/lib/python3.6/site-packages/push_notifications/gcm.py", line 209, in send_message
chunk, data, cloud_type=cloud_type, application_id=application_id, **kwargs
File "/home/project/server-side/.venv/lib/python3.6/site-packages/push_notifications/gcm.py", line 166, in _cm_send_request
return _cm_handle_response(registration_ids, response, cloud_type, application_id)
File "/home/project/server-side/.venv/lib/python3.6/site-packages/push_notifications/gcm.py", line 111, in _cm_handle_response
raise GCMError(response)
push_notifications.gcm.GCMError: {'multicast_id': 1826728239203974173, 'success': 4, 'failure': 1, 'canonical_ids': 0, 'results': [{'message_id': '0:1605278994023650%0f493ae6f9fd7ecd'}, {'message_id': '0:1605278994028849%2fd9afcdf9fd7ecd'}, {'error': 'InternalServerError'}, {'message_id': '0:1605278994038573%0f493ae6f9fd7ecd'}, {'message_id': '0:1605278994030881%cc9b4facf9fd7ecd'}]}
最有趣的是它有时可以工作,但有时我还没有找到错误。如果有人以前遇到过这个问题或者有人知道如何解决这个问题。请问你能帮忙吗?提前致谢!
解决方案
推荐阅读
- asp.net - “WriteLinesToFile”任务没有为所需参数“文件”指定值
- groovy - 如何在 groovy 脚本中将 UTC 时区转换为 CET 时区
- c - 为什么递归中的分段错误以找到函数的根?
- python - 使用 python selenium 访问网站时访问被拒绝
- list - 如何将字典中列表中的数字与另一个字典中的数字相乘
- java - 字符串列表到整数列表
- google-bigquery - 通过传输功能将数据从一个项目复制到 BQ 中的另一个项目是否需要成本?
- javascript - 用笑话模拟 setTimeout
- reactjs - 在 redux-toolkit 中处理相同功能的更正确方法是什么?
- json - 进行chainlink API调用时替代request.addStringArray