Python Firebase Course for Beginners

Welcome to Python Firebase Course for Beginners, in this Python Firebase Course

for Beginners we are going to work with Firebase using Python Programming Language.

especially we are going to work with Firebase Real Time Database, Firebase Authentication

and Firebase Storage. and also we will use pyrebase library for this article, pyrebase is  a

simple python wrapper for the Firebase API.

 

 

 

Installation 

First of all you need to install pyrebase by using pip command like this.

 

Note: Pyrebase is for Python3 and will not work in Python2.

 

 

More Python Firebase Tutorials 

1: Python Firebase Admin SDK Integration & Realtime Database

2: Python Firebase Full Course For Beginners 

 

 

 

If you are interested in Python Firebase Admin SDK, read the below articles 

1: Firebase SDK Integration with Real Time Database

2: Firebase SDK working with Cloud Firestore 

3: Python Firebase SDK Working with Authentication

 

 

 

 

 

First of all you need to Create New Project in Firebase Console. and after that add pyrebase

to your application. for use with only user based authentication we can create the following

configuration.

 

 

A Pyrebase app can use multiple Firebase services.

 

firebase.auth() – Authentication

firebase.database() – Database

firebase.storage() – Storage

 

 

 

 

1: Firebase Authentication ?

Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI

libraries to authenticate users to your app. It supports authentication using passwords,

phone numbers, popular federated identity providers like Google, Facebook and Twitter,

and more.Firebase Authentication integrates tightly with other Firebase services, and it

leverages industry standards like OAuth 2.0 and OpenID Connect, so it can be easily integrated

with your custom backend.

 

The sign_in_with_email_and_password() method will return user data including a

token you can use to adhere to security rules.

you can use this code for creating of users in your firebase console.

Make sure you have the Email/password provider enabled in your Firebase dashboard under

Auth -> Sign In Method.

 

 

 

 

 

Also you can sign in with the created user .

 

 

 

 

Also you can do verification for the email using this code.

 

 

 

 

Sending password reset emails.

 

 

 

 

2: Firebase Real Time Database

The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and

synchronized in realtime to every connected client. When you build cross-platform apps or

web applications , all of your clients share one Realtime Database instance and automatically

receive updates with the newest data.

 

Note: before this make sure that you have enabled firebase real time database in your

firebase console.

 

In here we are going to create firebase real time database, and after that we are going to

save the data, to save data with a unique, auto-generated, timestamp-based key, use

the push() method.

 

 

 

 

 

To create your own keys use the set() method. The key in the example below is “OwnKey”.

 

 

 

 

 

To update data for an existing entry use the update() method.

 

 

 

 

Queries return a PyreResponse object. Calling val() on these objects returns the query data.

Calling key() returns the key for the query data.

 

 

 

 

 

Each Returns a list of objects on each of which you can call val() and key().

 

 

 

 

 

For deleting data for an existing entry use the remove() method.

 

 

 

 

 

3: Firebase Storage

Cloud Storage for Firebase is a powerful, simple, and cost-effective object storage service built

for Google scale. The Firebase SDKs for Cloud Storage add Google security to file uploads and

downloads for your Firebase apps, regardless of network quality. You can use our SDKs to store

images, audio, video, or other user-generated content. On the server, you can use Google Cloud

Storage, to access the same files.

 

Note: make sure that you have enabled firebase storage in your firebase console.

 

 

 

First we create the storage object.

 

 

 

 

Using child just like with the Database service, you can build paths to your data with the

Storage service.

 

 

 

 

 

The put method takes the path to the local file and an optional user token.

 

 

 

 

So the download method takes the path to the saved database file and the name you want

the downloaded file to have.

 

 

 

 

 

 

Also you can watch the complete video for this article.

Subscribe and Get Free Video Courses & Articles in your Email

 

Share via
Copy link
Powered by Social Snap
×