Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ create_functions:

- aws lambda create-function \
--function-name feature-flipper-public \
--runtime python2.7 \
--runtime python3.9 \
--role $$(python lambda_role_arn.py) \
--handler lambda_function.lambda_handler \
--zip-file fileb://delete_me.zip

- aws lambda create-function \
--function-name feature-flipper-private \
--runtime python2.7 \
--runtime python3.9 \
--role $$(python lambda_role_arn.py) \
--handler lambda_function.lambda_handler \
--zip-file fileb://delete_me.zip
Expand Down
2 changes: 1 addition & 1 deletion server/deploy.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:2.7.11
FROM python:3.9.12

RUN apt-get -y update
RUN apt-get -y install zip
Expand Down
6 changes: 3 additions & 3 deletions server/private/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
def lambda_handler(req, context):
try:
return handle_request(req)
except HTTPError, e:
except HTTPError as e:
traceback.print_exc()
raise e
except Exception, e:
except Exception as e:
traceback.print_exc()
s500()

Expand All @@ -49,7 +49,7 @@ def handle_request(req):
if 'resource_path' not in req:
s400()

print(req['http_method'] + ' ' + req['resource_path'])
print('v2: ' + req['http_method'] + ' ' + req['resource_path'])
if req['http_method'] == "GET":

if req['resource_path'] == "/set/{set_id}":
Expand Down
9 changes: 5 additions & 4 deletions server/public/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
def lambda_handler(req, context):
try:
return handle_request(req)
except HTTPError, e:
except HTTPError as e:
traceback.print_exc()
raise e
except Exception, e:
except Exception as e:
traceback.print_exc()
s500()

Expand All @@ -41,7 +41,7 @@ def handle_request(req):
if 'resource_path' not in req:
s400()

print(req['http_method'] + ' ' + req['resource_path'])
print('v2: ' + req['http_method'] + ' ' + req['resource_path'])
if req['http_method'] == "GET":

if req['resource_path'] == "/sets":
Expand Down Expand Up @@ -206,7 +206,8 @@ def get_feature_set_data(setId):
if 'Item' in getDataRes:
item = getDataRes['Item']
if 'Data' in item and 'B' in item['Data']:
featureData = msgpack.loads(item['Data']['B'])
featureData = msgpack.loads(item['Data']['B'], encoding='utf-8')
print(featureData)
return featureData
else:
return {}
Expand Down
4 changes: 2 additions & 2 deletions server/virtualenv.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
rm -fr /host/virtualenv
mkdir /host/virtualenv
mkdir ve
virtualenv ve
python -m venv ve
source ve/bin/activate
pip install msgpack-python
cp -R /ve/lib/python2.7/site-packages/* /host/virtualenv
cp -R /ve/lib/python3.9/site-packages/* /host/virtualenv
2 changes: 1 addition & 1 deletion server/virtualenv.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:2.7.11
FROM python:3.9.12

ADD virtualenv.cmd /

Expand Down