From a9e852b23c3e5325dfdb3812afca729c3c91c948 Mon Sep 17 00:00:00 2001 From: FunctionsAPI Date: Thu, 9 Jan 2025 16:31:30 +0000 Subject: [PATCH] Automatic push from FunctionsAPI --- README.md | 3 +-- main.py | 16 ++++++++++++++++ requirements.txt | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 main.py create mode 100644 requirements.txt diff --git a/README.md b/README.md index 58904bf..ca9945f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# b6d6b3dbc3744dd694feb7d85dfc2539 - +# python hello-world diff --git a/main.py b/main.py new file mode 100644 index 0000000..f9f44f8 --- /dev/null +++ b/main.py @@ -0,0 +1,16 @@ +import json +import logging as log + +def main(request): + str_data = request.get_data(cache=True, as_text=True, parse_form_data=False) + print(f"print: {str_data}") + log.debug(f"dbg: {str_data}") + log.info(f"info: {str_data}") + log.warn(f"warn: {str_data}") + log.error(f"err: {str_data}") + try: + data = json.loads(str_data) + log.info(data) + except: + log.error("Provided data is not a valid json") + return str_data \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..55e8614 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +functions-framework==1.4.3 +markupsafe==2.0.1