Get an available port. Checks first for prefered port in case its available, if not returns random.
Project description
get-port
Get an available port. Checks first for preferred port in case its available, if not returns random. Python implementation of the get-port idea by @sindresorhus.
Installation.
Available via PyPI.
pip install get-port
Usage.
Available in terminal:
get-port [preferred-port-optional]
Usage in code:
# Gets the actual port. Send preferred_port to pick if available.
from get_port import get_port
port = get_port(preferred_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.3.tar.gz
(3.7 kB
view details)
File details
Details for the file get-port-0.0.3.tar.gz
.
File metadata
- Download URL: get-port-0.0.3.tar.gz
- Upload date:
- Size: 3.7 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39ce7fd761fff835cbe5f9c2d8f04c75874f5433800224de5528308dc0b64460 |
|
MD5 | 6e38e13c8617855b42de3858681ca677 |
|
BLAKE2b-256 | 99296156be0c52db210c6ff848644ee4ae1619e519227718ee3c9e91938ce1e9 |