Vallabh
Vallabh

Reputation: 103

Django Simple Push Notification to IOS

I want to create simple function for sending push notification to IOS devices. Inside my model i am storing Device_type and Device_token

for Android i had written simple code using requests like below

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. Can someone tell me how to write simplest example like this.

Upvotes: 2

Views: 2279

Answers (2)

beyondfloatingpoint
beyondfloatingpoint

Reputation: 1289

Since this questions still turns up in search, here is 2020 update version of Python3 HTTP2-compatible script to send push notifications.

Upvotes: 0

CodeBlooded
CodeBlooded

Reputation: 533

Maybe you are looking for django-push-notifications

Upvotes: 1

Related Questions