Skip to main content

Python library for gateways, networks, and devices.

Project description

gatenet

PyPI Docs CI Changelog

Gatenet is a Python toolkit for networking: diagnostics (ping, traceroute, DNS, ports), simple HTTP/TCP/UDP building blocks, service discovery, and Wi‑Fi hotspot management. It now includes a lightweight hooks system for easy extensibility.

Install

pip install gatenet

Python 3.10+ • Linux/macOS/Windows (feature availability varies by platform)

Highlights

  • Diagnostics: ICMP/TCP ping, traceroute, port scan, DNS, IP geolocation
  • HTTP/TCP/UDP: minimal server/client utilities
  • Discovery: pluggable detectors with a registry
  • Hotspot: create/manage Wi‑Fi access points (Linux/macOS)
  • Hooks: shared event bus across modules (HTTP, clients, discovery, diagnostics)

Quick start

HTTP server

from gatenet.http_.server import HTTPServerComponent

server = HTTPServerComponent(host="127.0.0.1", port=8080)

@server.route("/status", method="GET")
def status(_req):
    return {"ok": True}

server.start()

HTTP client

from gatenet.http_.client import HTTPClient

client = HTTPClient("http://127.0.0.1:8080")
res = client.get("/status")
print(res["data"])  # {"ok": True}

TCP / UDP

from gatenet.client.tcp import TCPClient
from gatenet.client.udp import UDPClient

# TCP
tcp = TCPClient("127.0.0.1", 9000)
tcp.connect()
print(tcp.send("ping"))
tcp.close()

# UDP
udp = UDPClient("127.0.0.1", 9001)
print(udp.send("ping"))
udp.close()

Diagnostics

from gatenet.diagnostics import ping
from gatenet.diagnostics.traceroute import traceroute

print(ping("1.1.1.1", count=2))
print(traceroute("example.com"))

Discovery

from gatenet.discovery.ssh import _identify_service

print(_identify_service(22, "SSH-2.0-OpenSSH_8.9p1"))

Hotspot (platform-dependent)

from gatenet.hotspot import Hotspot

hotspot = Hotspot(ssid="GatenetAP", password="SecurePass123!")
if hotspot.start():
    print("running")
    hotspot.stop()

Hooks & events

from gatenet.core import hooks, events

hooks.on(events.HTTP_BEFORE_REQUEST, lambda req: print("HTTP", req.command, req.path))

Learn more

Contributing

Run tests locally:

pytest -q

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

gatenet-0.12.3.tar.gz (58.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gatenet-0.12.3-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file gatenet-0.12.3.tar.gz.

File metadata

  • Download URL: gatenet-0.12.3.tar.gz
  • Upload date:
  • Size: 58.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for gatenet-0.12.3.tar.gz
Algorithm Hash digest
SHA256 201fe4ea5e20ab26bdd642b7a42cd5b797c90ab1601a62d3b5575e7cfa3bdde6
MD5 6df9fc5ab7b9a78eb1767b0bcbd0bbe8
BLAKE2b-256 b909b63404ceaaf44963aa19e1281d6490713fda7c997720d87705b66ac17f43

See more details on using hashes here.

File details

Details for the file gatenet-0.12.3-py3-none-any.whl.

File metadata

  • Download URL: gatenet-0.12.3-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.0

File hashes

Hashes for gatenet-0.12.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2f445347686a8909bf8841073f75fcbc2eb742bfdb9786269cceae1b6586b738
MD5 77d884b6f5edfffc1ba4ad202070d3cd
BLAKE2b-256 13733d4b0eda88032456d7615c550f480bd2eeb4ac5a6a58d643f259ca44d0bc

See more details on using hashes here.

Supported by

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