本文整理汇总了Python中libraries.app.app.App.lambda_handler方法的典型用法代码示例。如果您正苦于以下问题:Python App.lambda_handler方法的具体用法?Python App.lambda_handler怎么用?Python App.lambda_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libraries.app.app.App
的用法示例。
在下文中一共展示了App.lambda_handler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: redeploy_all_projects
# 需要导入模块: from libraries.app.app import App [as 别名]
# 或者: from libraries.app.app.App import lambda_handler [as 别名]
def redeploy_all_projects(deploy_function):
i = 0
one_day_ago = datetime.utcnow() - timedelta(hours=24)
for obj in App.cdn_s3_handler().get_objects(prefix='u/', suffix='build_log.json'):
i += 1
last_modified = obj.last_modified.replace(tzinfo=None)
if one_day_ago <= last_modified:
continue
App.lambda_handler().invoke(
FunctionName=deploy_function,
InvocationType='Event',
LogType='Tail',
Payload=json.dumps({
'prefix': App.prefix,
'build_log_key': obj.key
})
)
return True
示例2: send_payload_to_linter
# 需要导入模块: from libraries.app.app import App [as 别名]
# 或者: from libraries.app.app.App import lambda_handler [as 别名]
def send_payload_to_linter(self, payload, linter):
"""
:param dict payload:
:param TxModule linter:
:return bool:
"""
# TODO: Make this use urllib2 to make a async POST to the API. Currently invokes Lambda directly
payload = {
'data': payload,
'vars': {
'prefix': App.prefix
}
}
App.logger.debug('Sending Payload to linter {0}:'.format(linter.name))
App.logger.debug(payload)
linter_function = '{0}tx_lint_{1}'.format(App.prefix, linter.name)
response = App.lambda_handler().invoke(function_name=linter_function, payload=payload, async=True)
App.logger.debug('finished.')
return response