.. image:: https://img.shields.io/pypi/v/portend.svg
:target: https://pypi.org/project/portend
.. image:: https://img.shields.io/pypi/pyversions/portend.svg
.. image:: https://github.com/jaraco/portend/workflows/tests/badge.svg
:target: https://github.com/jaraco/portend/actions?query=workflow%3A%22tests%22
:alt: tests
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: Black
.. image:: https://readthedocs.org/projects/portend/badge/?version=latest
:target: https://portend.readthedocs.io/en/latest/?badge=latest
.. image:: https://img.shields.io/badge/skeleton-2023-informational
:target: https://blog.jaraco.com/skeleton
por·tend
pôrˈtend/
verb
be a sign or warning that (something, especially something momentous or calamitous) is likely to happen.
Usage
=====
Use portend to monitor TCP ports for bound or unbound states.
For example, to wait for a port to be occupied, timing out after 3 seconds::
portend.occupied('www.google.com', 80, timeout=3)
Or to wait for a port to be free, timing out after 5 seconds::
portend.free('::1', 80, timeout=5)
The portend may also be executed directly. If the function succeeds, it
returns nothing and exits with a status of 0. If it fails, it prints a
message and exits with a status of 1. For example::
python -m portend localhost:31923 free
(exits immediately)
python -m portend -t 1 localhost:31923 occupied
(one second passes)
Port 31923 not bound on localhost.
Portend also exposes a ``find_available_local_port`` for identifying
a suitable port for binding locally::
port = portend.find_available_local_port()
print(port, "is available for binding")
Portend additionally exposes the lower-level port checking functionality
in the ``Checker`` class, which currently exposes only one public
method, ``assert_free``::
portend.Checker().assert_free('localhost', 31923)
If assert_free is passed a host/port combination that is occupied by
a bound listener (i.e. a TCP connection is established to that host/port),
assert_free will raise a ``PortNotFree`` exception.
Raw data
{
"_id": null,
"home_page": "https://github.com/jaraco/portend",
"name": "portend",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Jason R. Coombs",
"author_email": "jaraco@jaraco.com",
"download_url": "https://files.pythonhosted.org/packages/8f/fc/bcfc768996b438d6e4bde7a6c8cfd62089847b0f5381a0e0ec2d8ee6b202/portend-3.2.0.tar.gz",
"platform": null,
"description": ".. image:: https://img.shields.io/pypi/v/portend.svg\n :target: https://pypi.org/project/portend\n\n.. image:: https://img.shields.io/pypi/pyversions/portend.svg\n\n.. image:: https://github.com/jaraco/portend/workflows/tests/badge.svg\n :target: https://github.com/jaraco/portend/actions?query=workflow%3A%22tests%22\n :alt: tests\n\n.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json\n :target: https://github.com/astral-sh/ruff\n :alt: Ruff\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n :alt: Code style: Black\n\n.. image:: https://readthedocs.org/projects/portend/badge/?version=latest\n :target: https://portend.readthedocs.io/en/latest/?badge=latest\n\n.. image:: https://img.shields.io/badge/skeleton-2023-informational\n :target: https://blog.jaraco.com/skeleton\n\npor\u00b7tend\np\u00f4r\u02c8tend/\nverb\n\n be a sign or warning that (something, especially something momentous or calamitous) is likely to happen.\n\nUsage\n=====\n\nUse portend to monitor TCP ports for bound or unbound states.\n\nFor example, to wait for a port to be occupied, timing out after 3 seconds::\n\n portend.occupied('www.google.com', 80, timeout=3)\n\nOr to wait for a port to be free, timing out after 5 seconds::\n\n portend.free('::1', 80, timeout=5)\n\nThe portend may also be executed directly. If the function succeeds, it\nreturns nothing and exits with a status of 0. If it fails, it prints a\nmessage and exits with a status of 1. For example::\n\n python -m portend localhost:31923 free\n (exits immediately)\n\n python -m portend -t 1 localhost:31923 occupied\n (one second passes)\n Port 31923 not bound on localhost.\n\nPortend also exposes a ``find_available_local_port`` for identifying\na suitable port for binding locally::\n\n port = portend.find_available_local_port()\n print(port, \"is available for binding\")\n\nPortend additionally exposes the lower-level port checking functionality\nin the ``Checker`` class, which currently exposes only one public\nmethod, ``assert_free``::\n\n portend.Checker().assert_free('localhost', 31923)\n\nIf assert_free is passed a host/port combination that is occupied by\na bound listener (i.e. a TCP connection is established to that host/port),\nassert_free will raise a ``PortNotFree`` exception.\n",
"bugtrack_url": null,
"license": "",
"summary": "TCP port monitoring and discovery",
"version": "3.2.0",
"project_urls": {
"Homepage": "https://github.com/jaraco/portend"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a3c57041b39bcad182a37ec6ea92e7e478a460db6277c542e6d417e34246bdac",
"md5": "572c2bfe4202140d6df072d457ad2a34",
"sha256": "8b3fe3f78779df906559a21d9eaa6e21c8fa5a7a8cc76362cbbe1e16777399cf"
},
"downloads": -1,
"filename": "portend-3.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "572c2bfe4202140d6df072d457ad2a34",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5350,
"upload_time": "2023-06-27T23:35:24",
"upload_time_iso_8601": "2023-06-27T23:35:24.385283Z",
"url": "https://files.pythonhosted.org/packages/a3/c5/7041b39bcad182a37ec6ea92e7e478a460db6277c542e6d417e34246bdac/portend-3.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8ffcbcfc768996b438d6e4bde7a6c8cfd62089847b0f5381a0e0ec2d8ee6b202",
"md5": "0c3a2e8073c384b826f87795766f1e0e",
"sha256": "5250a352c19c959d767cac878b829d93e5dc7625a5143399a2a00dc6628ffb72"
},
"downloads": -1,
"filename": "portend-3.2.0.tar.gz",
"has_sig": false,
"md5_digest": "0c3a2e8073c384b826f87795766f1e0e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 10514,
"upload_time": "2023-06-27T23:35:25",
"upload_time_iso_8601": "2023-06-27T23:35:25.900954Z",
"url": "https://files.pythonhosted.org/packages/8f/fc/bcfc768996b438d6e4bde7a6c8cfd62089847b0f5381a0e0ec2d8ee6b202/portend-3.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-27 23:35:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jaraco",
"github_project": "portend",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "portend"
}