Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated README to include sample usage, a list of key features and in… #769

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down