当前位置: 首页>>代码示例>>Python>>正文


Python boto3.__version__方法代码示例

本文整理汇总了Python中boto3.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python boto3.__version__方法的具体用法?Python boto3.__version__怎么用?Python boto3.__version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boto3的用法示例。


在下文中一共展示了boto3.__version__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: determine_prefix

# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import __version__ [as 别名]
def determine_prefix():
    """Placeholder docstring"""
    prefix = "AWS-SageMaker-Python-SDK/{} Python/{} {}/{} Boto3/{} Botocore/{}".format(
        SDK_VERSION, PYTHON_VERSION, OS_NAME, OS_VERSION, boto3.__version__, botocore.__version__
    )

    try:
        with open("/etc/opt/ml/sagemaker-notebook-instance-version.txt") as sagemaker_nbi_file:
            prefix = "AWS-SageMaker-Notebook-Instance/{} {}".format(
                sagemaker_nbi_file.read().strip(), prefix
            )
    except IOError:
        # This file isn't expected to always exist, and we DO want to silently ignore failures.
        pass

    return prefix 
开发者ID:aws,项目名称:sagemaker-python-sdk,代码行数:18,代码来源:user_agent.py

示例2: get_endpoint_hosts

# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import __version__ [as 别名]
def get_endpoint_hosts():
    print('Extracting endpoint list from boto3 version {} ...'.format(boto3.__version__))

    EC2_REGIONS = set(boto3.Session().get_available_regions('ec2'))
    S3_REGIONS = set(boto3.Session().get_available_regions('s3'))
    ALL_REGIONS = sorted(EC2_REGIONS | S3_REGIONS)
    ALL_SERVICES = get_services()

    result = {}
    for service in ALL_SERVICES:
        print('  ...looking for {} in all regions...'.format(service))
        result[service] = {}
        for region in ALL_REGIONS:
            result[service][region] = boto3.Session(region_name=region).client(service).meta.endpoint_url

    print('...done.')
    return result 
开发者ID:JohannesEbke,项目名称:aws_list_all,代码行数:19,代码来源:introspection.py

示例3: show_version

# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import __version__ [as 别名]
def show_version():
    """ display version information and then exit """
    import os
    import inspect
    import awscli
    import boto3
    import botocore
    import subprocess
    print("aws_with version: {}".format(sys.modules["aws_with"].VERSION))
    print("aws_with key libraries:")
    print("    aws {} from {}".format(
        subprocess.check_output(['aws','--version'], stderr=subprocess.STDOUT).replace('\n',''),
        subprocess.check_output(['which','aws']).replace('\n','')
    ))
    print("    awscli {} from {}".format(awscli.__version__, os.path.dirname(inspect.getfile(awscli))))
    print("    boto3 {} from {}".format(boto3.__version__, os.path.dirname(inspect.getfile(boto3))))
    print("    botocore {} from {}".format(botocore.__version__, os.path.dirname(inspect.getfile(botocore))))
    print("    python {} from {}".format(sys.version.replace('\n',''), sys.executable))
    sys.exit(0) 
开发者ID:aws-samples,项目名称:aws-with,代码行数:21,代码来源:cli.py

示例4: __init__

# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import __version__ [as 别名]
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() 
开发者ID:skarlekar,项目名称:faces,代码行数:36,代码来源:session.py

示例5: test_version

# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import __version__ [as 别名]
def test_version(self):
    self.assertEqual(boto3.__version__, '1.4.7') 
开发者ID:bazelbuild,项目名称:rules_python,代码行数:4,代码来源:boto_test.py

示例6: check_requirements

# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import __version__ [as 别名]
def check_requirements(script_path, requirements_file = None):
    """
    Check versions of opinel and boto3
    :param script_path:
    :return:
    """
    script_dir = os.path.dirname(script_path)
    opinel_min_version = opinel_max_version = boto3_min_version = boto3_max_version = None
    # Requirements file is either next to the script or in data/requirements
    if not requirements_file:
        requirements_file = os.path.join(script_dir, 'data/requirements.txt')
        if not os.path.isfile(requirements_file):
            requirements_file = os.path.join(script_dir, 'requirements.txt')
    with open(requirements_file, 'rt') as f:
        for requirement in f.readlines():
            opinel_requirements = re_opinel.match(requirement)
            if opinel_requirements:
                opinel_requirements = opinel_requirements.groups()
                opinel_min_version = opinel_requirements[0]
                opinel_max_version = opinel_requirements[1]
            boto3_requirements = re_boto3.match(requirement)
            if boto3_requirements:
                boto3_requirements = boto3_requirements.groups()
                boto3_min_version = boto3_requirements[0]
                boto3_max_version = boto3_requirements[1]
    if not check_versions(opinel_min_version, OPINEL_VERSION, opinel_max_version, 'opinel'):
        return False
    if not check_versions(boto3_min_version, boto3.__version__, boto3_max_version, 'boto3'):
        return False
    return True 
开发者ID:nccgroup,项目名称:opinel,代码行数:32,代码来源:globals.py

示例7: test_patches

# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import __version__ [as 别名]
def test_patches():
    print("Boto3 version: {} aiobotocore version: {}".format(
        boto3.__version__, aiobotocore.__version__))

    success = True
    for obj, digests in _API_DIGESTS.items():
        digest = hashlib.sha1(getsource(obj).encode('utf-8')).hexdigest()
        if digest not in digests:
            print("Digest of {}:{} not found in: {}".format(
                obj.__qualname__, digest, digests))
            success = False

    assert success 
开发者ID:terrycain,项目名称:aioboto3,代码行数:15,代码来源:test_patches.py


注:本文中的boto3.__version__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。