[英]Django Simple Push Notification to IOS
I want to create simple function for sending push notification to IOS devices.我想创建一个简单的函数来向 IOS 设备发送推送通知。 Inside my model i am storing Device_type and Device_token
在我的模型中,我正在存储 Device_type 和 Device_token
for Android i had written simple code using requests like below对于 Android,我使用如下请求编写了简单的代码
import requests, json
def send_push_notif_android(device_token,title,msg):
payload = {
"to" : device_token,
"notification" : {
"title": title,
"text": msg
}
}
url = "https://fcm.googleapis.com/fcm/send"
header = {
"Content-Type":"application/json",
"Authorization":"key = <app key>"
}
requests.post(url, data=json.dumps(payload), headers=header)
I dont know how to do it for IOS i had generated Certificates.pem file and kept it in my root folder.我不知道如何为 IOS 执行此操作,我已生成 Certificates.pem 文件并将其保存在我的根文件夹中。 Can someone tell me how to write simplest example like this.
有人能告诉我如何写这样的最简单的例子吗?
也许您正在寻找django-push-notifications
由于这个问题仍然出现在搜索中, 这里是 Python3 HTTP2 兼容脚本的 2020 更新版本,用于发送推送通知。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.