Simple host:port parser
Project description
Simple parser strings like as grpchost:50051.
Installation
$ pip install hostport
Usage
>>> 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('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)
It’s all.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hostport-1.0.tar.gz
(1.7 kB
view details)
Built Distribution
File details
Details for the file hostport-1.0.tar.gz
.
File metadata
- Download URL: hostport-1.0.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df68bbd8562098614e3e3960f38a5f4a44cbe4a0e3fc2008620b998f915dfd77 |
|
MD5 | 35ea989a555ad559e92045d789c01601 |
|
BLAKE2b-256 | 5f6332957102707e048c51fd78b2a4ad2faa76e46b8c765f80432c502a4034fc |
File details
Details for the file hostport-1.0-py3-none-any.whl
.
File metadata
- Download URL: hostport-1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a81ef9e4c66a5d5d9f88ef249ced4d05b06f3a7fdd9cf7d06ab69650eacf4bd4 |
|
MD5 | fa0abb40f244b1f19c2722126d29a35d |
|
BLAKE2b-256 | 56e6a01e1f9fa4a50b8cf413f60c1763274b5f2a405e02319bae2a6a4139b0a2 |