Registry / messaging / firebase-messaging

firebase-messaging

JSON →
library0.4.5pypypi✓ verified 30d ago

A Python client for Firebase Cloud Messaging (FCM) and Google Cloud Messaging (GCM) for sending push notifications. Current version 0.4.5 supports HTTP v1 API and legacy HTTP APIs. Actively maintained with weekly releases.

messaging
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from firebase_messaging import FcmPushClient
from firebase_messaging import FcmPushClientConfig
from firebase_messaging import FcmRegisterConfig

Sends a push notification to a single device token using Firebase Cloud Messaging HTTP v1 API.

from firebase_messaging import FirebaseMessaging import os # Initialize with service account JSON file path fb = FirebaseMessaging(credentials_file=os.environ.get('FCM_CREDENTIALS', '')) # Send a simple notification response = fb.send_notification( token='device_token', title='Hello', body='World' ) print(response)
Debug
Known footguns
gotchaThe `credentials_file` parameter expects the path to a JSON service account key file, not the raw JSON string. Passing a string that is not a valid file path raises a `FileNotFoundError`.
deprecatedLegacy FCM API (HTTP XMPP) support is deprecated in v0.4.5 and will be removed in v0.5. Use the HTTP v1 API instead.
breakingIn v0.4.0, the import paths changed. `FirebaseMessaging` was moved from `firebase_messaging.client` to `firebase_messaging`. Old imports will raise `ImportError`.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
24 hits · last 30 days
gptbot
3
amazonbot
3
bytedance
3
ahrefsbot
1
Resources