<filename>function/__init__.py
"""Google Cloud Function."""

import json
import logging

import azure.functions as func

import palpiteiro


def main(req: func.HttpRequest) -> func.HttpResponse:
    """Azure function main execution."""
    logging.info("Python HTTP trigger function processed a request.")

    # Get arguments.
    args = req.params
    algo = args.get("algorithm", palpiteiro.DEFAULT_ARGS["algorithm"])
    scheme = args.get("scheme", palpiteiro.DEFAULT_ARGS["scheme"])
    price = args.get("price", palpiteiro.DEFAULT_ARGS["price"])

    # Make sures types are correct.
    algo = str(algo)
    scheme = str(scheme)
    price  = float(price)

    # Validate arguments.
    palpiteiro.validate_argument(val=algo, arg="algorithm")
    palpiteiro.validate_argument(val=scheme, arg="scheme")

    # Main exec.
    res = palpiteiro.main(scheme=scheme, algorithm=algo, price=price)
    return func.HttpResponse(json.dumps(res, default=str), status_code=200)

<filename>function/__init__.py
"""Google Cloud Function."""

import json
import logging

import azure.functions as func

import palpiteiro


def main(req: func.HttpRequest) -> func.HttpResponse:
    """Azure function main execution."""
    logging.info("Python HTTP trigger function processed a request.")

    # Get arguments.
    args = req.params
    algo = args.get("algorithm", palpiteiro.DEFAULT_ARGS["algorithm"])
    scheme = args.get("scheme", palpiteiro.DEFAULT_ARGS["scheme"])
    price = args.get("price", palpiteiro.DEFAULT_ARGS["price"])

    # Make sures types are correct.
    algo = str(algo)
    scheme = str(scheme)
    price  = float(price)

    # Validate arguments.
    palpiteiro.validate_argument(val=algo, arg="algorithm")
    palpiteiro.validate_argument(val=scheme, arg="scheme")

    # Main exec.
    res = palpiteiro.main(scheme=scheme, algorithm=algo, price=price)
    return func.HttpResponse(json.dumps(res, default=str), status_code=200)

Google Cloud Function. Azure function main execution. # Get arguments. # Make sures types are correct. # Validate arguments. # Main exec.