Toggle navigation
Toggle navigation
This project
Loading...
Sign in
서승완
/
kappa
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Jose Diaz-Gonzalez
2016-06-12 01:04:10 -0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
152860b9f5b8db66658add7998a5195a943735e7
152860b9
1 parent
83a48552
Fix code smells in simple.py
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
0 deletions
samples/python/_src/simple.py
samples/simple/_src/simple.py
samples/sns/_src/sns.py
samples/python/_src/simple.py
View file @
152860b
...
...
@@ -21,6 +21,7 @@ def foobar():
def
_get
(
event
,
context
):
assert
context
customer_id
=
event
.
get
(
'id'
)
if
customer_id
is
None
:
raise
Exception
(
'No id provided for GET operation'
)
...
...
@@ -32,6 +33,7 @@ def _get(event, context):
def
_post
(
event
,
context
):
assert
context
item
=
event
[
'json_body'
]
if
item
is
None
:
raise
Exception
(
'No json_body found in event'
)
...
...
@@ -41,6 +43,7 @@ def _post(event, context):
def
_put
(
event
,
context
):
assert
context
data
=
_get
(
event
,
context
)
id_
=
data
.
get
(
'id'
)
data
.
update
(
event
[
'json_body'
])
...
...
@@ -51,6 +54,7 @@ def _put(event, context):
def
handler
(
event
,
context
):
assert
context
LOG
.
info
(
event
)
http_method
=
event
.
get
(
'http_method'
)
if
not
http_method
:
...
...
samples/simple/_src/simple.py
View file @
152860b
...
...
@@ -5,5 +5,6 @@ LOG.setLevel(logging.DEBUG)
def
handler
(
event
,
context
):
assert
context
LOG
.
debug
(
event
)
return
{
'status'
:
'success'
}
...
...
samples/sns/_src/sns.py
View file @
152860b
...
...
@@ -6,6 +6,7 @@ LOG.setLevel(logging.INFO)
def
handler
(
event
,
context
):
assert
context
for
record
in
event
[
'Records'
]:
start_time
=
record
[
'Sns'
][
'Timestamp'
]
LOG
.
info
(
'start_time:
%
s'
,
start_time
)
...
...
Please
register
or
login
to post a comment