Advanced Firebase
Project description
Advanced Firebase
Advanced Firebase ia a library that adds more functional to standart firebase sdk.
Installation
Use the package manager pip to install Advanced Firebase.
pip install advancedfirebase
MODULES
DB
This module is only for use with Realtime Database.
All functions:
- Get
- Getkey
- Update
- Set
- Parse
Example database*
{
'fruits:{
⠀
⠀⠀⠀'apple':{
⠀⠀⠀⠀⠀⠀'color': 'red'
⠀⠀⠀⠀⠀⠀}
⠀
⠀⠀⠀'banana':{
⠀⠀⠀⠀⠀⠀'color': 'yellow'
⠀⠀⠀⠀⠀⠀}
⠀
⠀⠀⠀'kiwi':{
⠀⠀⠀⠀⠀⠀'color': 'green'
⠀⠀⠀⠀⠀⠀}
⠀
⠀⠀⠀}
}
*This is database that used in examples
Project initialize
from advancedfirebase import db
db.init('url', 'credentials.json')
Get
Args: path
out = db.get('/fruits/apple')
print(out)
OUTPUT:
{'color': 'red'}
Getkey
Args: path, key
out = db.getkey('/fruits/apple','color')
print(out)
OUTPUT:
red
Update
Args: path, obj
object = {
'apple':{
'color':'green',
'size':'large'
}
}
db.update('/fruits/', object)
Result:
{
'fruits:{
⠀
⠀⠀⠀'apple':{
⠀⠀⠀⠀⠀⠀'color': 'green',
⠀⠀⠀⠀⠀⠀'size': 'large'
⠀⠀⠀⠀⠀⠀}
⠀
⠀⠀⠀'banana':{
⠀⠀⠀⠀⠀⠀'color': 'yellow'
⠀⠀⠀⠀⠀⠀}
⠀
⠀⠀⠀'kiwi':{
⠀⠀⠀⠀⠀⠀'color': 'green'
⠀⠀⠀⠀⠀⠀}
⠀
⠀⠀⠀}
}
Set
object = {
'apple':{
'color':'green',
'size':'large'
}
}
db.set('/fruits/', object)
Result:
{
'fruits:{
⠀
⠀⠀⠀'apple':{
⠀⠀⠀⠀⠀⠀'color': 'green',
⠀⠀⠀⠀⠀⠀'size': 'large'
⠀⠀⠀⠀⠀⠀}
⠀⠀⠀}
}
Parse
req = db.get('/fruits/apple')
print(req)
print(db.parse(req, 'color'))
OUTPUT:
{'color':'red'}
red
Made by Artem Lukashenko
v1.1.4
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file advancedfirebase-1.1.4-py3-none-any.whl
.
File metadata
- Download URL: advancedfirebase-1.1.4-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1aefb204ded2cb6f6000e808699fdb31394faf58464deb4ecab9f3d2a72b01ad |
|
MD5 | 8145c48ede2a5fb96088cadf680f8f55 |
|
BLAKE2b-256 | 90520ecfe7633db7362c7c597695b80c6c09c70d505e2797eb5880f5cd7e6e29 |