本文整理匯總了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