Firebase Service
Simple Python wrapper for Firebase Realtime Database using firebase-admin.
Install
pip install firebase-service
Setup
- Create a Firebase project
- Generate a service account JSON
- Place it in your project root as:
firebase.json
The package loads
firebase.jsonfrom the current working directory (CWD).
Usage
from firebase_service import FirebaseService
db = FirebaseService("test_node")
db.set("counter", 0)
print(db.get("counter"))
db.increment("counter", 5)
print(db.get("counter"))
Root Values
You can use None to access the root of your node:
db.set(None, "hello")
print(db.get(None))
Methods
get(directory=None)
Get data from a path.
set(directory, value)
Set a value at a path.
delete(directory)
Delete a value.
increment(directory, delta=1)
Atomically increment a number.
update(directory, callback)
Update a value using a function.
db.update("counter", lambda x: x * 2)
Example
from firebase_service import FirebaseService
emotion = FirebaseService("emotion_node")
emotion.set(None, "neutral")
def next_state(state):
order = ["neutral", "happy", "sad", "angry"]
return order[(order.index(state) + 1) % len(order)] if state in order else "neutral"
emotion.update(None, next_state)
print(emotion.get(None))
Notes
- Requires
firebase.jsonin the working directory - Uses Firebase Admin SDK
- Designed for simple scripts and small backends
License
MIT
Metadata
Release files for firebase-service 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| firebase_service-0.1.0.tar.gz | 40.6 kB | Without provenance | Details for firebase_service-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| firebase_service-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for firebase_service-0.1.0-py3-none-any.whl |
Total release size: 43.5 kB
Release files / firebase_service-0.1.0.tar.gz
| Download URL | firebase_service-0.1.0.tar.gz |
|---|---|
| Size | 40.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7da5ba7e40e66c1a7ee056dec30db4964e62c2da218476edb1dc67c6a4d7e97b
|
|
BLAKE2b-256 checksum How to use checksums |
a098dcbb14fe40c2ca6c487d74c06710b021b08229c4ee737feefefb4bf413ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / firebase_service-0.1.0-py3-none-any.whl
| Download URL | firebase_service-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ae66281b21ec5d2655a6c40f6ab0ff9f083f2dc4318dec4d66204f92d84351b
|
|
BLAKE2b-256 checksum How to use checksums |
6c1292becab5fb52b75846077b16b374211e9c8bb2155870252835ea86a73ba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for firebase-service 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.