我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用click.exceptions()。
def unschedule(self): """ Given a a list of scheduled functions, tear down their regular execution. """ # Run even if events are not defined to remove previously existing ones (thus default to []). events = self.stage_config.get('events', []) if not isinstance(events, list): # pragma: no cover print("Events must be supplied as a list.") return function_arn = None try: function_response = self.zappa.lambda_client.get_function(FunctionName=self.lambda_name) function_arn = function_response['Configuration']['FunctionArn'] except botocore.exceptions.ClientError as e: # pragma: no cover raise ClickException("Function does not exist, you should deploy first. Ex: zappa deploy {}. " "Proceeding to unschedule CloudWatch based events.".format(self.api_stage)) print("Unscheduling..") self.zappa.unschedule_events( lambda_name=self.lambda_name, lambda_arn=function_arn, events=events, ) # Remove async task SNS if self.stage_config.get('async_source', None) == 'sns' \ and self.stage_config.get('async_resources', True): removed_arns = self.zappa.remove_async_sns_topic(self.lambda_name) click.echo('SNS Topic removed: %s' % ', '.join(removed_arns))