简单的host:port解析器
项目描述
简单解析类似grpchost:50051的字符串。
安装
$ pip install hostport
用法
>>> import hostport
>>> hostport.parse('host:30')
HostPort(host='host', port=30)
>>> hostport.parse('host:30').host
'host'
>>> hostport.parse('host:30').port
30
>>> hostport.parse('[fe80::95f3]:50051')
HostPort(host='[fe80::95f3]', port=50051)
>>> hostport.parse('[fe80::95f3]')
HostPort(host='[fe80::95f3]', port=None)
>>> hostport.parse('host', default_port=30)
HostPort(host='host', port=30)
>>> hostport.parse('30', default_host='host')
HostPort(host='host', port=30)
>>> hostport.parse('host.production:50051', default_host='host', default_port=30)
HostPort(host='host.production', port=50051)
>>> hostport.parse('host.production')
HostPort(host='host.production', port=None)
>>> hostport.parse('50051')
HostPort(host=None, port=50051)
这就是全部。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。
源代码分发
hostport-1.1.tar.gz (1.8 kB 查看哈希值)
构建分发
hostport-1.1-py3-none-any.whl (2.1 kB 查看哈希值)
关闭
hostport-1.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 0ceae7fa42430f93ac23ed0eb35df2b3263c276c13f946ab7698ce67f6850de6 |
|
MD5 | c7b0c3c10326199f981f84a936dd8cc0 |
|
BLAKE2b-256 | 7e54f12fc2485b78e236e5687f3de1314882a39039b1bde684fd6bfb26f12b88 |