From 3cfe922ff326ccdfd765e524d337c2e1bcad3d90 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sun, 14 Oct 2018 14:27:09 +0200 Subject: github-lambda: support api-gateway webhooks github deprecated services, to focus on webhooks. sns won't work anymore https://developer.github.com/changes/2018-10-01-denying-new-github-services/ --- src/blogc-github-lambda/lambda_function.py.in | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/blogc-github-lambda/lambda_function.py.in b/src/blogc-github-lambda/lambda_function.py.in index 37d3828..285a395 100644 --- a/src/blogc-github-lambda/lambda_function.py.in +++ b/src/blogc-github-lambda/lambda_function.py.in @@ -153,7 +153,7 @@ def sync_s3(src, dest, settings_file): remote_files[filename].delete() -def sns_handler(message): +def blogc_handler(message): print 'blogc-github-lambda %s' % BLOGC_VERSION payload = json.loads(message) @@ -193,6 +193,9 @@ def sns_handler(message): def lambda_handler(event, context): - for record in event['Records']: - if 'Sns' in record: - sns_handler(record['Sns']['Message']) + if 'Records' in event: # sns + for record in event['Records']: + if 'Sns' in record: + blogc_handler(record['Sns']['Message']) + elif 'body' in event: # api-gateway + blogc_handler(event['body']) -- cgit v1.2.3-18-g5258