推挽通知蟒蛇服务器
pusher-push-notifications的Python项目详细描述
pusher-beams python服务器sdk
可以找到这个sdk的完整文档here
使用量
为实例配置sdk
使用你的实例id和secret(你可以从 dashboard)创建beams pushnotifications实例:
from pusher_push_notifications import PushNotifications pn_client = PushNotifications( instance_id='YOUR_INSTANCE_ID_HERE', secret_key='YOUR_SECRET_KEY_HERE', )
发布到设备兴趣
您可以使用Device Interests:
response = pn_client.publish_to_interests( interests=['hello'], publish_body={ 'apns': { 'aps': { 'alert': 'Hello!' } }, 'fcm': { 'notification': { 'title': 'Hello', 'body': 'Hello, World!' } } } ) print(response['publishId'])
向经过身份验证的用户发布
response = pn_client.publish_to_users( user_ids=['user-0001'], publish_body={ 'apns': { 'aps': { 'alert': 'Hello!' } }, 'fcm': { 'notification': { 'title': 'Hello', 'body': 'Hello, World!' } } } ) print(response['publishId'])