Skip to main content

Simple host:port parser

Project description

https://travis-ci.org/zzzsochi/hostport.svg?branch=master https://coveralls.io/repos/github/zzzsochi/hostport/badge.svg?branch=master

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('[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)

It’s all.

Project details


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.1.tar.gz (1.8 kB view details)

Uploaded Source

Built Distribution

hostport-1.1-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file hostport-1.1.tar.gz.

File metadata

  • Download URL: hostport-1.1.tar.gz
  • Upload date:
  • Size: 1.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for hostport-1.1.tar.gz
Algorithm Hash digest
SHA256 0ceae7fa42430f93ac23ed0eb35df2b3263c276c13f946ab7698ce67f6850de6
MD5 c7b0c3c10326199f981f84a936dd8cc0
BLAKE2b-256 7e54f12fc2485b78e236e5687f3de1314882a39039b1bde684fd6bfb26f12b88

See more details on using hashes here.

File details

Details for the file hostport-1.1-py3-none-any.whl.

File metadata

  • Download URL: hostport-1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for hostport-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e00ada89fcb86f7128d23044fd6466209e756a073a06674e57b076251be5d676
MD5 49654c3e26fc57c50de0dc909d5422e3
BLAKE2b-256 df7ec2bf232eff2cfe320bdca3d195657ba8f3533865620750ac5a858525a2e2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page