Skip to main content

Get an available port. Checks first for prefered port in case its available, if not returns random.

Project description

get-port

Open Source Love license Last Commit

Get an available port. Checks first for prefered port in case its available, if not returns random. Python implementation of the get-port idea by @sindresorhus.

Installation.

Available via PyPy.

pip install get-port

Usage.

Available in terminal:

get-port [prefered-port-optional]

Usage in code:

# Gets the actual port. Send prefered_port to pick if available.
from get_port import get_port
port = get_port(prefered_port)

# Check if port is available. Returns tuple: (Boolean, Dict)
from get_port import port_available
is_available = port_available(your_port)

# Find random free port. Returns tuple: (Port, Dict)
from get_port import find_free_port
port = find_free_port()

License

MIT.

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

get-port-0.0.1.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file get-port-0.0.1.tar.gz.

File metadata

  • Download URL: get-port-0.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for get-port-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0e0462d69aefad3415577bc38b917b1cab2ec666c2db9db4b27ea9bed7ddfd2c
MD5 e0acf805e7c1113d89e944918c122e21
BLAKE2b-256 8d49e6ff23fe7d1336da7b42be3ba0408b102f96ceb60b89e2894f903ee0b57e

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