我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用boto3.__version__()。
def __init__(self, aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, region_name=None, botocore_session=None, profile_name=None): if botocore_session is not None: self._session = botocore_session else: # Create a new default session self._session = botocore.session.get_session() # Setup custom user-agent string if it isn't already customized if self._session.user_agent_name == 'Botocore': botocore_info = 'Botocore/{0}'.format( self._session.user_agent_version) if self._session.user_agent_extra: self._session.user_agent_extra += ' ' + botocore_info else: self._session.user_agent_extra = botocore_info self._session.user_agent_name = 'Boto3' self._session.user_agent_version = boto3.__version__ if profile_name is not None: self._session.set_config_variable('profile', profile_name) if aws_access_key_id or aws_secret_access_key or aws_session_token: self._session.set_credentials( aws_access_key_id, aws_secret_access_key, aws_session_token) if region_name is not None: self._session.set_config_variable('region', region_name) self.resource_factory = ResourceFactory( self._session.get_component('event_emitter')) self._setup_loader() self._register_default_handlers()
def __init__(self, service): print ("In init") print (boto3.__version__) self.session.resource(service) self.awsauth = AWSRequestsAuth( aws_access_key="credentials.access_key", aws_secret_access_key="credentials.secret_key", aws_token="credentials.token", aws_host="self.es_host", aws_region="us-east-1", aws_service=service )
def lambda_handler(event, context): print(boto3.__version__) # TODO implement #1850bf7b-af0c-40c6-a480-00aeda2a2966 session = boto3.session.Session() ecsClient = session.client(service_name='ecs') ecsResponse = ecsClient.update_container_instances_state(cluster='ecs-cd-Cluster-QPJZXE8U4HDM',containerInstances=['1850bf7b-af0c-40c6-a480-00aeda2a2966'],status='DRAINING') print ("Response = " , ecsResponse) return 'Hello from Lambda'