From 810f9670de4b57819cda2a19c58bcd52c6ca0f4d Mon Sep 17 00:00:00 2001 From: theteacat Date: Thu, 23 Mar 2023 13:12:14 +0000 Subject: [PATCH 1/3] Remove requests and xray --- examples/minimal-python/aws_requirements.txt | 2 -- examples/minimal-python/handler.py | 4 ---- 2 files changed, 6 deletions(-) diff --git a/examples/minimal-python/aws_requirements.txt b/examples/minimal-python/aws_requirements.txt index 3e21672..94eb19f 100644 --- a/examples/minimal-python/aws_requirements.txt +++ b/examples/minimal-python/aws_requirements.txt @@ -1,3 +1 @@ -aws-xray-sdk -requests firetail-lambda \ No newline at end of file diff --git a/examples/minimal-python/handler.py b/examples/minimal-python/handler.py index 3a3a5de..31154f0 100644 --- a/examples/minimal-python/handler.py +++ b/examples/minimal-python/handler.py @@ -2,14 +2,10 @@ # Deps in src/vendor sys.path.insert(0, 'src/vendor') -import requests from firetail_lambda import firetail_handler, firetail_app app = firetail_app() -from aws_xray_sdk.core import xray_recorder -from aws_xray_sdk.core import patch_all -patch_all() @firetail_handler(app) def endpoint(event, context): From f20a6dfbd1b949595d421966aa611e9a1a17502b Mon Sep 17 00:00:00 2001 From: theteacat Date: Thu, 23 Mar 2023 13:12:25 +0000 Subject: [PATCH 2/3] Tidy imports --- examples/minimal-python/handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/minimal-python/handler.py b/examples/minimal-python/handler.py index 31154f0..f087ca2 100644 --- a/examples/minimal-python/handler.py +++ b/examples/minimal-python/handler.py @@ -1,9 +1,11 @@ -import sys, base64, datetime, json, os, time +import datetime +import json +import sys # Deps in src/vendor sys.path.insert(0, 'src/vendor') -from firetail_lambda import firetail_handler, firetail_app +from firetail_lambda import firetail_handler, firetail_app # noqa: E402 app = firetail_app() From d4195673e6666623740f4af317b5974a78eb76f3 Mon Sep 17 00:00:00 2001 From: theteacat Date: Thu, 23 Mar 2023 13:14:26 +0000 Subject: [PATCH 3/3] Add Current-Time header to example --- examples/minimal-python/handler.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/minimal-python/handler.py b/examples/minimal-python/handler.py index f087ca2..3e7684d 100644 --- a/examples/minimal-python/handler.py +++ b/examples/minimal-python/handler.py @@ -11,9 +11,13 @@ @firetail_handler(app) def endpoint(event, context): + current_time = datetime.datetime.now().time() return { "statusCode": 200, "body": json.dumps({ - "message": "Hello, the current time is %s" % datetime.datetime.now().time() - }) - } \ No newline at end of file + "message": "Hello, the current time is %s" % current_time + }), + "headers": { + "Current-Time": "%s" % current_time + } + }