mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Blog API example (#377)
This commit is contained in:
1
examples/apps/hellos/python/.gitignore
vendored
Normal file
1
examples/apps/hellos/python/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
packages/
|
||||
1
examples/apps/hellos/python/README.md
Normal file
1
examples/apps/hellos/python/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# Python function
|
||||
21
examples/apps/hellos/python/func.py
Normal file
21
examples/apps/hellos/python/func.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
|
||||
sys.stderr.write("Starting Python Function\n")
|
||||
|
||||
name = "I speak Python too"
|
||||
|
||||
try:
|
||||
if not os.isatty(sys.stdin.fileno()):
|
||||
try:
|
||||
obj = json.loads(sys.stdin.read())
|
||||
if obj["name"] != "":
|
||||
name = obj["name"]
|
||||
except ValueError:
|
||||
# ignore it
|
||||
sys.stderr.write("no input, but that's ok\n")
|
||||
except:
|
||||
pass
|
||||
|
||||
print "Hello, " + name + "!"
|
||||
4
examples/apps/hellos/python/func.yaml
Normal file
4
examples/apps/hellos/python/func.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
name: python
|
||||
version: 0.0.11
|
||||
runtime: python
|
||||
entrypoint: python2 func.py
|
||||
Reference in New Issue
Block a user