diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-10-14 14:27:09 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-10-14 14:27:09 +0200 |
commit | 3cfe922ff326ccdfd765e524d337c2e1bcad3d90 (patch) | |
tree | cff99bbd1df037492cac7092a81856bd3f97759e | |
parent | 339ee98eea55acbfde954b2d245d6933b4b16ba6 (diff) | |
download | blogc-3cfe922ff326ccdfd765e524d337c2e1bcad3d90.tar.gz blogc-3cfe922ff326ccdfd765e524d337c2e1bcad3d90.tar.bz2 blogc-3cfe922ff326ccdfd765e524d337c2e1bcad3d90.zip |
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/
-rw-r--r-- | src/blogc-github-lambda/lambda_function.py.in | 11 |
1 files 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']) |