Posts

Showing posts with the label Python

Playing with dates in python

Image
Date in python In this tutorial you will be able to. Get current date/time Get weeks first and last date based on current date/time Get months first and last date based on current date/time First we will find current date time Step 1: Import necessary libraries (for above all task this is necessary step) from datetime import datetime, timedelta from calendar import monthrange Step 2: Get current date/time and just print it today = datetime.now() print(today) Now we will find weeks first and last date based on current date/time start = datetime.now() - timedelta(days=datetime.now().weekday()) end = start + timedelta(days=6) print(start) print(end) Now we will find months first and last date based on current date/time start = datetime.now().replace(day=1) end = datetime.now().replace(day=monthrange(datetime.now().year, datetime.now().month)[1]) print(start) print(end) Complete code: from datetime import datetime, timedelta from cale...

Add/Set array in Firestore with the Firebase Admin SDK : Python 🐍

Image
The Admin SDK lets you interact with Firebase from privileged environments to perform actions like: ·          Read and write Realtime Database data with full admin privileges ·          Programmatically send Firebase Cloud Messaging messages using a simple, alternative approach to the FCM server protocols. ·          Generate and verify Firebase auth tokens. ·          Access Google Cloud Platform resources like Cloud Storage buckets and Firestore databases associated with your Firebase projects. ·          Create your own simplified admin console to do things like look up user data or change a user's email address for authentication. Currently Node.js, Java, Python, Go, C# are supported languages in Admin SDK. This tutorial demonstrates addin...

Add/Set collection in Firestore with the Firebase Admin SDK : Python 🐍

Image
The Admin SDK lets you interact with Firebase from privileged environments to perform actions like: ·          Read and write Realtime Database data with full admin privileges. ·          Programmatically send Firebase Cloud Messaging messages using a simple, alternative approach to the FCM server protocols. ·          Generate and verify Firebase auth tokens. ·          Access Google Cloud Platform resources like Cloud Storage buckets and Firestore databases associated with your Firebase projects. ·          Create your own simplified admin console to do things like look up user data or change a user's email address for authentication. Currently Node.js, Java, Python, Go, C# are supported languages in Admin SDK. This tutorial demonstrates adding collection in Fires...