diff --git a/README.md b/README.md index f7cae21ff..d0bb09973 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,38 @@ Admin Python SDK enables access to Firebase services from privileged environment (such as servers or cloud) in Python. Currently this SDK provides Firebase custom authentication support. +Key Features of the Firebase Admin Python SDK: +* Authentication: Manage users, verify tokens, and integrate with Firebase Authentication. +* Realtime Database: Interact with Firebase Realtime Database, allowing you to retrieve, update, and listen for changes in the data stored in your Firebase database in real-time. +* Cloud Firestore: Access and manipulate documents and collections in Firestore, Firebase's NoSQL cloud database, with support for transactions, batched writes, and complex queries. +* Cloud Messaging (FCM): Send notifications or messages directly from your server to your users' devices via Firebase Cloud Messaging. +* Cloud Storage: Upload, download, and manage files stored in Firebase Cloud Storage. +* Remote Config: Programmatically change the behavior and appearance of your app without publishing an app update, by modifying configurations for different user segments. + + For more information, visit the [Firebase Admin SDK setup guide](https://firebase.google.com/docs/admin/setup/). +## Example Usage +Here's a simple example that demonstrates how to add a new document to a Firestore collection: +``` +from firebase_admin import firestore + +# Get a reference to the Firestore service +db = firestore.client() + +# Add a new document +doc_ref = db.collection(u'users').document(u'alovelace') +doc_ref.set({ + u'first': u'Ada', + u'last': u'Lovelace', + u'born': 1815 +}) + +print("Document added.") + +``` + ## Installation @@ -32,6 +61,18 @@ in a terminal: ``` pip install firebase-admin +``` +Before you can use the SDK, you need to initialize it with your project's credentials. This usually involves downloading a service account key from your Firebase project settings and initializing the SDK with this key. + +Here's an example of how to initialize the Firebase Admin SDK in Python: +``` +import firebase_admin +from firebase_admin import credentials + +# Initialize the app with a service account, granting admin privileges +cred = credentials.Certificate('path/to/serviceAccountKey.json') +firebase_admin.initialize_app(cred) + ``` ## Contributing