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


Python URL.port方法代码示例

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


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

示例1: URL

# 需要导入模块: from purl import URL [as 别名]
# 或者: from purl.URL import port [as 别名]
        service_config = config_request.json()
        log.debug('Service config: %s', service_config)
    except:
        log.error("Invalid configuration URI", exc_info=True)
        sys.exit(2)

    # Do some sanity checks on the config
    requiredAttribs = ['serviceName', 'package', 'components', 'configurations']
    for attrib in requiredAttribs:
        if not attrib in service_config:
            log.error("Invalid configuration. Missing required attribute '%s'", attrib)
            sys.exit(3)

    log.info('Installing service: %s on ambari host: %s', service_config['serviceName'], args.ambari_host)
    ambari_host_uri = URL(args.ambari_host)
    ambari_client = Ambari(ambari_host_uri.host(), port=ambari_host_uri.port(), protocol=ambari_host_uri.scheme(), username=args.username, password=args.password, identifier='hdiapps')
    # If this is being invoked from outside the cluster, we must fixup the href references contained within the responses
    ambari_client.client.request_params['hooks'] = dict(response=shared_lib.Fixup(ambari_host_uri).fixup)
    # Assume we only have 1 cluster managed by this Ambari installation 
    cluster = ambari_client.clusters.next()
    log.debug('Cluster: %s, href: %s', cluster.cluster_name, cluster._href)

    # Pull in any extra dynamic configuration
    if args.extra_config:
        try:
            extra_config = json.loads(args.extra_config)
            log.debug('Applying dynamic service configuration specified on command-line: %s', extra_config)
        except:
            log.warning('Extra configuration specified by the -x argument could not be parsed as JSON. The value was \'%s\'. Details: ', args.extra_config, exc_info=True)
            extra_config = {}    
    else:
开发者ID:hdinsight,项目名称:Iaas-Applications,代码行数:33,代码来源:install_ambari_application.py

示例2: test_remove_port

# 需要导入模块: from purl import URL [as 别名]
# 或者: from purl.URL import port [as 别名]
 def test_remove_port(self):
     url = URL('https://example.com/hello?x=100')
     new = url.port('')
     self.assertEqual('https://example.com/hello?x=100', str(new))
开发者ID:codeinthehole,项目名称:purl,代码行数:6,代码来源:url_tests.py


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