diff --git a/firebase_admin/db.py b/firebase_admin/db.py index d6f5f99f0..03bbabaf3 100644 --- a/firebase_admin/db.py +++ b/firebase_admin/db.py @@ -125,11 +125,12 @@ def child(self, path): full_path = self._pathurl + '/' + path return Reference(client=self._client, path=full_path) - def get(self, etag=False): + def get(self, etag=False, shallow=False): """Returns the value, and optionally the ETag, at the current location of the database. Args: etag: A boolean indicating whether the Etag value should be returned or not (optional). + shallow: A boolean indicating whether the result will be shallow or not (optional). Returns: object: If etag is False returns the decoded JSON value of the current database location. @@ -139,12 +140,15 @@ def get(self, etag=False): Raises: ApiCallError: If an error occurs while communicating with the remote database server. """ + params = {'shallow': shallow} if shallow else None if etag: headers, data = self._client.headers_and_body( - 'get', self._add_suffix(), headers={'X-Firebase-ETag' : 'true'}) + 'get', self._add_suffix(), headers={'X-Firebase-ETag' : 'true'}, + params=params) return data, headers.get('ETag') else: - return self._client.body('get', self._add_suffix()) + return self._client.body( + 'get', self._add_suffix(), params=params) def get_if_changed(self, etag): """Gets data in this location only if the specified ETag does not match.