Skip to main content

Various helper functions for Google Cloud services

Project description

Overview

gcp-ng-helpers is a Python library that provides helper functions for interacting with Google Cloud Platform (GCP) services.

Installation

Use the package manager pip to install gcp-ng-helpers

pip install gcp-ng-helpers

Functions submodule

Http Router

Cloud function by default only serves single '/' (root) http endpoint. With this Http Router you can easily serve much more, without need to parse Request object for method and path

Usage

Define a function with flask.Request argument returning the flaks.Response object Import HttpRouter from functions submodule and register defined function as route with path and method Then inside cloud function entry point function return router.response

from flask import Request, Response, make_response
from gcp_helpers.functions.routers import HttpRouter


def hello_route(request: Request) -> Response:
    return make_response('Hello', 200)


router = HttpRouter()
router.register(hello_route, '/hello', 'GET')


def main(request):
    return router.response(request)

or

from flask import Request, Response, make_response
from gcp_helpers.functions.routers import HttpRouter

router = HttpRouter()

@router.route("/hello", 'GET')
def hello_route(request: Request) -> Response:
    return make_response('Hello', 200)


def main(request):
    return router.response(request)

Tasks submodule

Manager

CloudTasksManager class is wrapper for cloud task api. Allows to shorten task creation. Currently, supports only http task creation

Firestore

Collection

FirestoreCollection and FirestoreCollectionGroup are wrappers for firestore read/write operations bounded to the defined collection or collection group.

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

gcp_ng_helpers-0.0.19.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

gcp_ng_helpers-0.0.19-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

Supported by

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