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.6.tar.gz (59.9 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.6-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for gatenet-0.12.6.tar.gz
Algorithm Hash digest
SHA256 db2e0a8620617e742b61b8b88df3e244a893258f41be3c638011012618970640
MD5 16820acd2f80b51f7f4c04df4bc6cb6b
BLAKE2b-256 520c086226f8fbd9447d616d4397d4a238f1a4925349ceba31ac98e08d4a9f02

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gatenet-0.12.6-py3-none-any.whl
Algorithm Hash digest
SHA256 433965ea7c379ca4fb07d0c288f5fc5fe72382b75d0bf7dabc61a8bb7a628eea
MD5 3beac77dfe56a37eb4552e9bb366966d
BLAKE2b-256 3c4cb583201a4cf44f2bb467835a77a7b213cf3d48d423b3f82cd730a4c5f6a6

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