Created
March 12, 2020 06:04
-
-
Save taikulawo/183ca8aca78d8ea540d44cf21f0af407 to your computer and use it in GitHub Desktop.
阿里云函数计算-API网关-参数透传-函数计算-模板
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import logging | |
import json | |
# if you open the initializer feature, please implement the initializer function, as below: | |
# def initializer(context): | |
# logger = logging.getLogger() | |
# logger.info('initializing') | |
def handler(event, context): | |
logger = logging.getLogger() | |
logger.info(event) | |
logger.info(context) | |
return { | |
"isBase64Encoded":False, | |
"statusCode":200, | |
"headers":{}, | |
"body":"..." | |
} | |
# event结构 | |
# { | |
# "path":"api request path", | |
# "httpMethod":"request method name", | |
# "headers":{all headers,including system headers}, | |
# "queryParameters":{query parameters}, | |
# "pathParameters":{path parameters}, | |
# "body":"string of request payload", | |
# "isBase64Encoded":"true|false, indicate if the body is Base64-encode" | |
# } | |
# context存放ali相关的信息 | |
# https://help.aliyun.com/document_detail/74756.html?spm=a2c4g.11174283.6.565.5b565212jrvRvY#general-handler-interface |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment