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.5.tar.gz (59.1 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.5-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gatenet-0.12.5.tar.gz
  • Upload date:
  • Size: 59.1 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.5.tar.gz
Algorithm Hash digest
SHA256 c025a80e75a595f7a3679ef1b0cd5b3f0294b176680f3763284a96c3cfc8708e
MD5 36706b3aae98eaa5d794c9541fae418c
BLAKE2b-256 edf718e158ea22c2abd92d5dd190ef2252a3e1e6709197dcc14b8fb93df0ba80

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gatenet-0.12.5-py3-none-any.whl
  • Upload date:
  • Size: 21.8 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 46967f17dfa0b7ecdd7e4a94ae60985c7ac161366a60999a1c5a23177da3f55c
MD5 599765692dc896a216a7070e835038d1
BLAKE2b-256 5d035d85b88d6fa83610082c9f8fc7b41ebb1c74e3d5c1e016e8a50650ef763a

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