From 6addaadf417deab853d4a8f79e6dda0ab0dd68bf Mon Sep 17 00:00:00 2001 From: Iliana Weller Date: Mon, 3 Jul 2017 19:48:42 -0500 Subject: [PATCH] stallmanW --- kappa123/server/main/views.py | 13 ++++++++++++- requirements.txt | 5 +++-- zappa_settings.json | 9 ++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/kappa123/server/main/views.py b/kappa123/server/main/views.py index d92868e..e5a6156 100644 --- a/kappa123/server/main/views.py +++ b/kappa123/server/main/views.py @@ -5,7 +5,8 @@ #### imports #### ################# -from flask import render_template, Blueprint +import botocore.session +from flask import render_template, Blueprint, request, redirect #from aaaaaaa import pack_ints, unpack_ints from kappa123.server.runs import inject_run_class, fetch_or_cache_runs def pack_ints(s): @@ -48,3 +49,13 @@ def returning_user(preferences): "main/home.html", runs=runs ) + +@main_blueprint.route("/code") +def agplv3_compliance(): + context = request.environ.get('lambda.context') + session = botocore.session.get_session() + # region name is detected from lambda environment + client = session.create_client('lambda') + code = client.get_function(FunctionName=context.function_name, + Qualifier=context.function_version) + return redirect(code['Code']['Location'], code=303) diff --git a/requirements.txt b/requirements.txt index d8dd15e..3517185 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,10 @@ +# zappa needs to come first because it locks to deps :( +zappa + coverage==4.3.4 Flask==0.12 Flask-Bootstrap==3.3.7.1 -Werkzeug==0.12 simplejson requests arrow -zappa diff --git a/zappa_settings.json b/zappa_settings.json index 27aa9b0..4dd837f 100644 --- a/zappa_settings.json +++ b/zappa_settings.json @@ -3,6 +3,13 @@ "app_function": "kappa123.server.__init__.app", "aws_region": "us-west-2", "profile_name": "gdqdotmoe", - "s3_bucket": "zappa-n2am4xeny" + "s3_bucket": "zappa-n2am4xeny", + "extra_permissions": [ + { + "Effect": "Allow", + "Action": "lambda:GetFunction", + "Resource": "*" + } + ] } }