From 960f5b9d9ce68f9f479cef032ad580690a244ba5 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Mon, 21 Aug 2023 16:02:06 +0530 Subject: [PATCH] add python cloud function --- cloud-functions/python/.firebaserc | 5 ++ cloud-functions/python/.gitignore | 68 +++++++++++++++++++ cloud-functions/python/functions/.gitignore | 0 cloud-functions/python/functions/main.py | 17 +++++ .../python/functions/requirements.txt | 1 + 5 files changed, 91 insertions(+) create mode 100644 cloud-functions/python/.firebaserc create mode 100644 cloud-functions/python/.gitignore create mode 100644 cloud-functions/python/functions/.gitignore create mode 100644 cloud-functions/python/functions/main.py create mode 100644 cloud-functions/python/functions/requirements.txt diff --git a/cloud-functions/python/.firebaserc b/cloud-functions/python/.firebaserc new file mode 100644 index 0000000..0dccf08 --- /dev/null +++ b/cloud-functions/python/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "hpos-af3cc" + } +} diff --git a/cloud-functions/python/.gitignore b/cloud-functions/python/.gitignore new file mode 100644 index 0000000..128b9c0 --- /dev/null +++ b/cloud-functions/python/.gitignore @@ -0,0 +1,68 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +firebase-debug.log* +firebase-debug.*.log* + +# Firebase cache +.firebase/ + +# Firebase config + +# Uncomment this if you'd like others to create their own Firebase project. +# For a team working on the same Firebase project(s), it is recommended to leave +# it commented so all members can deploy to the same project(s) in .firebaserc. +# .firebaserc + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +venv \ No newline at end of file diff --git a/cloud-functions/python/functions/.gitignore b/cloud-functions/python/functions/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/cloud-functions/python/functions/main.py b/cloud-functions/python/functions/main.py new file mode 100644 index 0000000..52f04f1 --- /dev/null +++ b/cloud-functions/python/functions/main.py @@ -0,0 +1,17 @@ +# Deploy with `firebase deploy` + +from firebase_functions import https_fn +from firebase_admin import initialize_app + +# initialize_app() +# +# +# @https_fn.on_request() +# def on_request_example(req: https_fn.Request) -> https_fn.Response: +# return https_fn.Response("Hello world!") + +initialize_app() + +@https_fn.on_request() +def on_request_example(req: https_fn.Request) -> https_fn.Response: + return https_fn.Response("Hello world!") diff --git a/cloud-functions/python/functions/requirements.txt b/cloud-functions/python/functions/requirements.txt new file mode 100644 index 0000000..bcf4c12 --- /dev/null +++ b/cloud-functions/python/functions/requirements.txt @@ -0,0 +1 @@ +firebase_functions~=0.1.0 \ No newline at end of file