Skip to main content

A Python module for handling a Firebase database

Project description

Certainly! Here's an example README.md file for your module:

# pyfirebasehandler

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Your Module is a Python module for handling a Firebase database using the `firebase-admin` library.

## Installation

You can install Your Module using pip:

```shell
pip install pyfirebasehandler

Make sure you have the firebase-admin library installed as well.

Usage

from pyfirebasehandler.firebase_handler import FirebaseHandler

# Initialize FirebaseHandler with credentials
handler = FirebaseHandler('path/to/credentials.json')

# Create a document
data = {'name': 'John Doe', 'age': 30}
document_id = handler.create_document('users', data)

## for creating a document with a custom reference
document_id = handler.create_document('users', data, custom_ref="id01")
print(f"Created document with ID: {document_id}")

# Retrieve a document
document_data = handler.get_document('users', document_id)
print(f"Retrieved document data: {document_data}")

# Retrive list of documents from a collection
collection_data = handler.read_collection('users')
print(f"Retrieved list of collection data: {document_data}")

# Update a document
updated_data = {'age': 31}
handler.update_document('users', document_id, updated_data)
print("Document updated successfully")

# Delete a document
handler.delete_document('users', document_id)
print("Document deleted successfully")

Replace 'path/to/credentials.json' with the actual path to your Firebase service account credentials JSON file.

Tests

To run the tests for Module, execute the following command:

python -m unittest tests.test_firebase_handler

Make sure you have the necessary test credentials for your Firebase database.

License

This project is licensed under the terms of the MIT License. See the LICENSE file for details.

MIT License

Copyright (c) 2023 pyfirebasehandler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyfirebasehandler-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyfirebasehandler-1.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file pyfirebasehandler-1.0.0.tar.gz.

File metadata

  • Download URL: pyfirebasehandler-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for pyfirebasehandler-1.0.0.tar.gz
Algorithm Hash digest
SHA256 54c73373a819bf55eedc9bc8fda771582dc07affe57e59c2587d85927d97901b
MD5 73d2a5b781a866f040933c908cda3855
BLAKE2b-256 1d2cb4ddd5292a1ab815500c163a264bb808723774e0ef4753428992aed38b2b

See more details on using hashes here.

File details

Details for the file pyfirebasehandler-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyfirebasehandler-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a76a1196b6f734e6395491b6f8fd1357001ba79198c7d9393077d113965b8cdc
MD5 74e8585710af6bb09bc3a65c73e5b860
BLAKE2b-256 afc14ab8411b7b2d2cdb1afaf767d0030b75d66a07f3c094d574edf204982232

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page