firebasil.rtdb module

class firebasil.rtdb.EventType(value)

An enumeration.

class firebasil.rtdb.OnEvent(*args, **kwds)
class firebasil.rtdb.Rtdb(database_url: str, id_token: Optional[str] = None, access_token: Optional[str] = None)

A connection to a realtime database. Should be used as an async context manager, which yields the root RtdbNode of the database.

access_token: Optional[str] = None

Access token, for example for service accounts (optional)

database_url: str

URL of the realtime database, including schema

id_token: Optional[str] = None

User ID token (optional)

class firebasil.rtdb.RtdbEvent(event: firebasil.rtdb.EventType, path: Optional[str] = None, data: Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]] = None)

An event from the realtime database

data: Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]] = None

Body of the event, either the new or updated values

event: firebasil.rtdb.EventType

Type of event

path: Optional[str] = None

Path of the event, relative to the listener

class firebasil.rtdb.RtdbNode(_rtdb: firebasil.rtdb.Rtdb, path: str = '', query_params: Optional[Dict[str, Any]] = None)

A node within the realtime database

child(*path: str) firebasil.rtdb.RtdbNode

Get a child of this node

async delete() None

Remove the value of a node, and all sub-nodes

end_at(value: Any) firebasil.rtdb.RtdbNode

Return values ending at value under some ordering.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-filtering

equal_to(value: Any) firebasil.rtdb.RtdbNode

Return values with value equal to value under some ordering.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-filtering

events() AsyncGenerator[asyncio.Queue[RtdbEvent], None]

Async context manager that listens to the event stream of this node and adds events to the async queue that it yields.

export_format() firebasil.rtdb.RtdbNode

Include priority data in responses

See https://firebase.google.com/docs/reference/rest/database#section-param-format

async get() Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]]

Get the value of a node

limit_to_first(limit: int) firebasil.rtdb.RtdbNode

Only return the first limit results after some ordering and filtering is applied.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-filtering

limit_to_last(limit: int) firebasil.rtdb.RtdbNode

Only return the last limit results after some ordering and filtering is applied.

order_by(child_location: str) firebasil.rtdb.RtdbNode

Order filtering operations by the value of a specified (possibly nested) child node.

Note, this does not order results, as they are returned as unordered JSON.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-ordered-data

order_by_key() firebasil.rtdb.RtdbNode

Order filtering operations by key.

Note, this does not order results, as they are returned as unordered JSON.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-ordered-data

order_by_priority() firebasil.rtdb.RtdbNode

Order filtering operations by priority.

Note, this does not order results, as they are returned as unordered JSON.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-ordered-data

order_by_value() firebasil.rtdb.RtdbNode

Order filtering operations by node value.

Note, this does not order results, as they are returned as unordered JSON.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-ordered-data

path: str = ''

Location of this node in the database

async push(data: Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]]) str

Push data into a list, returning the ID of the new node.

See https://firebase.google.com/docs/database/web/lists-of-data

async set(data: Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]]) Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]]

Set the value of a node

shallow() firebasil.rtdb.RtdbNode

Create a node that only gets shallow data

See https://firebase.google.com/docs/reference/rest/database#section-param-shallow

start_at(value: Any) firebasil.rtdb.RtdbNode

Return values starting at value under some ordering.

See https://firebase.google.com/docs/database/rest/retrieve-data#section-rest-filtering

timeout(timeout: datetime.timedelta) firebasil.rtdb.RtdbNode

Set a request timeout.

See https://firebase.google.com/docs/reference/rest/database#section-param-timeout

async update(data: Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]]) Union[None, str, int, float, bool, List[JSON], Mapping[str, JSON]]

Update data at a given location with new JSON.

See https://firebase.google.com/docs/database/web/read-and-write#updating_or_deleting_data

write_size_limit(limit: firebasil.rtdb.SizeLimit) firebasil.rtdb.RtdbNode

Limit write sizes.

See https://firebase.google.com/docs/reference/rest/database#section-param-writesizelimit

class firebasil.rtdb.SizeLimit(value)

An enumeration.