Last active
November 23, 2018 09:57
-
-
Save l3acucm/a2779fd614aa8c5f04aee832a667d90c to your computer and use it in GitHub Desktop.
Sends data-only-payloaded message to FCM topic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # coding: utf-8 | |
| import requests, json | |
| API_KEY = "" | |
| url = "https://fcm.googleapis.com/fcm/send" | |
| body = { | |
| "to": "/topics/ru", | |
| "data": { | |
| "title":"mytitle", | |
| "detail":"huimarjovy", | |
| } | |
| } | |
| headers = {"Content-Type":"application/json", "Authorization": f"key={API_KEY}"} | |
| print(requests.post(url, data=json.dumps(body), headers=headers).content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment