Beispiel #1
0
def mainfunction():
    if request.method == 'GET':
        print('user requested all products')
        return Interact_with_nosql.get_all_products()
    elif request.method == 'POST':
        ProductName = request.args.get('Name')
        ProductDesc = request.args.get('Desc')
        ProductValue = request.args.get('Value')
        print(
            f'user wants to post product {ProductName}:\n{ProductDesc}\n{ProductValue}'
        )
        if ProductName is None:
            return '<h1>Name is required</h1>'
        return Interact_with_nosql.post_product(ProductName, ProductDesc,
                                                ProductValue)
    elif request.method == 'PUT':
        ProductName = request.args.get('Name')
        ProductDesc = request.args.get('Desc')
        ProductValue = request.args.get('Value')
        if ProductName is None:
            return '<h1>Name is required</h1>'
        print(
            f'user wants to update product {ProductName}:\n{ProductDesc}\n{ProductValue}'
        )
        return Interact_with_nosql.put_product(ProductName, ProductDesc,
                                               ProductValue)
    elif request.method == 'DELETE':
        ProductName = request.args.get('Name')
        print(f'user wants to delete product {ProductName}')
        return Interact_with_nosql.delete_product(ProductName)
Beispiel #2
0
def individualfunction(product):
    if request.method == 'GET':
        print(f'user requested product: {product}')
        return Interact_with_nosql.get_single_product(product)

    elif request.method == 'DELETE':
        print(f'user wants to delete product {product}')
        return Interact_with_nosql.delete_product(product)
Beispiel #3
0
def mainfunction():
    if request.method == 'GET':
        print('user requested all users')
        return Interact_with_nosql.get_all_repos_users()
    elif request.method == 'POST':
        entrada = request.args.get('Username')
        print(f'user wants to post gituser {entrada}')
        return Interact_with_nosql.post_repos_and_user(entrada)
Beispiel #4
0
def main(req: func.HttpRequest) -> func.HttpResponse:

    name = req.route_params.get('id')

    if name:
        logging.info(f'Python HTTP trigger function processed a get request with name:{name}')
        return Interact_with_nosql.get_single_product(name)
    else:
        logging.info('Python HTTP trigger function processed a get request')
        return Interact_with_nosql.get_all_products()
Beispiel #5
0
def individualfunction(gituser):
    if request.method == 'GET':
        print(f'user requested gituser: {gituser}')
        return Interact_with_nosql.get_single_repos_user(gituser)
    elif request.method == 'PUT':
        print(f'user wants to update gituser {gituser}')
        return Interact_with_nosql.put_repos_and_user(gituser)
    elif request.method == 'DELETE':
        print(f'user wants to delete gituser {gituser}')
        return Interact_with_nosql.delete_repos_and_user(gituser)
    elif request.method == 'POST':
        print(f'user wants to post gituser {gituser}')
        return Interact_with_nosql.post_repos_and_user(gituser)
Beispiel #6
0
def main(req: func.HttpRequest) -> func.HttpResponse:

    name = req.params.get('Name')
    desc = req.params.get('Desc')
    value = req.params.get('Value')
    if not name:
        return "Name is required"
    else:
        return Interact_with_nosql.post_product(name,desc,value)
Beispiel #7
0
def main(req: func.HttpRequest) -> func.HttpResponse:

    name = req.route_params.get('id')

    if name:
        logging.info(
            f'Python HTTP trigger function processed a delete request with name:{name}'
        )
        return Interact_with_nosql.delete_product(name)
    else:
        return "Name for deletion not provided, somehow"
Beispiel #8
0
def main(req: func.HttpRequest) -> func.HttpResponse:

    return Interact_with_nosql.get_all_products()