尝试这个:
pip install pyfcm
OR
pip install git+git://github.com/olucurious/PyFCM.git
例子:
# Send to single device.
from pyfcm import FCMNotification
push_service = FCMNotification(api_key="<api-key>")
registration_id = "<device registration_id>"
message_title = "Uber update"
message_body = "Hi john, your customized news for today is ready"
result = push_service.notify_single_device(registration_id=registration_id, message_title=message_title, message_body=message_body)
# Send to multiple devices by passing a list of ids.
registration_ids = ["<device registration_id 1>", "<device registration_id 2>", ...]
message_title = "Uber update"
message_body = "Hope you're having fun this weekend, don't forget to check today's news"
result = push_service.notify_multiple_devices(registration_ids=registration_ids, message_title=message_title, message_body=message_body)
print result
你只需要使用firebase。从他们和您的 device_registration_id 或 device_token 获取 api 密钥,您就完成了。
更多您可以点击以下链接