Skip to content

guoPhineas/pyAPNsKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyAPNsKit

简体中文

Send requests to Apple Push Notification service (APNs) to push notifications to users via HTTP/2, token-based

pip install pyAPNsKit

Get Started

Quickly push information to devices

from pyAPNsKit import apns

p8key=""
with open('AuthKey_KeyID.p8','r') as p8file:
    p8key=p8file.read()
client=apns.Client("teamID","App_BundleID","KeyID",p8key)
isSuccess=client.sendAlert('deviceToken','title','subtitle','message',sound=True)

Note

For parameters, their acquisition methods, and instructions, please refer to the Apple Developer Document

Customized

from pyAPNsKit import apns,APNsHeader,APNsBody,types

p8key=""
with open('AuthKey_KeyID.p8','r') as p8file:
    p8key=p8file.read()

apnsHeader=APNsHeader.APNsHeader("teamID","topic","KeyID",p8key,types.PushType.alert)
isSuccess=apns.pushByDeviceToken('deviceToken',
               apnsHeader
                .withAPNsCollapse('Collapse')
               ,
               APNsBody.APNsBody()
                .withAlert("title","sub","message")
                .withSound()
             # ,isSandbox=True
)

About

Send requests to Apple Push Notification service (APNs) to push notifications to users via HTTP/2, token-based

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages