一個使用http2的蘋果推送python版SDK

只須要執行:html

pip install applepush

使用方法:python

# coding:UTF-8

from applepush import ApplePush

apns = ApplePush('證書路徑', 'bundle ID')
print apns.single_push('蘋果設備token', "推送內容")

返回值說明:git

{
    'status': 成功爲200,錯誤爲其它,
    'headers': {
      'apns-id': 蘋果推送返回的UUID,
    },
    'data': 蘋果接口返回的字符串,
    'error_msg': 錯誤緣由,若是推送成功爲None
}

status請參考:https://developer.apple.com/library/prerelease/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW15

代碼地址:https://github.com/yubang/applepushgithub

相關文章
相關標籤/搜索