From ffd12223b79987b4b9e8705ed1cb8be060dcdeb4 Mon Sep 17 00:00:00 2001 From: Kenneth Rosario Date: Thu, 26 Jan 2023 11:50:06 -0800 Subject: [PATCH] chore(functions/concepts-stateless): Update sample to use declarative signature (#9040) Co-authored-by: Charles Engelke --- functions/concepts-stateless/main.py | 5 +++-- functions/concepts-stateless/requirements-test.txt | 1 + functions/concepts-stateless/requirements.txt | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 functions/concepts-stateless/requirements.txt diff --git a/functions/concepts-stateless/main.py b/functions/concepts-stateless/main.py index 062a12bc2eb5..cf9b9e7a7b20 100644 --- a/functions/concepts-stateless/main.py +++ b/functions/concepts-stateless/main.py @@ -12,14 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -import time +# [START functions_concepts_stateless] +import functions_framework -# [START functions_concepts_stateless] # Global variable, modified within the function by using the global keyword. count = 0 +@functions_framework.http def statelessness(request): """ HTTP Cloud Function that counts how many times it is executed diff --git a/functions/concepts-stateless/requirements-test.txt b/functions/concepts-stateless/requirements-test.txt index e80042419ca0..474ff7c906ae 100644 --- a/functions/concepts-stateless/requirements-test.txt +++ b/functions/concepts-stateless/requirements-test.txt @@ -1,2 +1,3 @@ flask==2.1.0 pytest==7.0.1 +functions-framework==3.3.0 diff --git a/functions/concepts-stateless/requirements.txt b/functions/concepts-stateless/requirements.txt new file mode 100644 index 000000000000..5f5d4e8daee2 --- /dev/null +++ b/functions/concepts-stateless/requirements.txt @@ -0,0 +1 @@ +functions-framework==3.3.0