Blog API example (#377)

This commit is contained in:
Travis Reeder
2017-09-29 15:59:39 -07:00
committed by GitHub
parent a491d1bfde
commit 35bcc4e658
39 changed files with 218 additions and 0 deletions

View File

@@ -0,0 +1 @@
packages/

View File

@@ -0,0 +1 @@
# Python function

View 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 + "!"

View File

@@ -0,0 +1,4 @@
name: python
version: 0.0.11
runtime: python
entrypoint: python2 func.py