Skip to main content

Python client to talk to WatchYourLAN APIs

Project description

watchyourlanclient

Python API client to interact with WatchYourLAN

Example usage

from watchyourlanclient import WatchYourLANClient

async def main_async():
    api_client = WatchYourLANClient(base_url="http://localhost:8840", async_mode=True)

    try:
        # Get all hosts
        hosts = await api_client.get_all_hosts()
        print("Async Hosts:", hosts)

        # Get history for a specific MAC
        history = await api_client.get_host_history("00:11:22:33:44:55")
        print("Async Host History:", history)

        # Get port state
        port_state = await api_client.get_port_state("192.168.1.10", 80)
        print("Async Port State:", port_state)

    finally:
        await api_client.close()

def main_sync():
    api_client = WatchYourLANClient(base_url="http://localhost:8840", async_mode=False)

    try:
        # Get all hosts
        hosts = api_client.get_all_hosts()
        print("Sync Hosts:", hosts)

        # Get history for a specific MAC
        history = api_client.get_host_history("00:11:22:33:44:55")
        print("Sync Host History:", history)

        # Get port state
        port_state = api_client.get_port_state("192.168.1.10", 80)
        print("Sync Port State:", port_state)

    finally:
        api_client.close_sync()

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

watchyourlanclient-2024.1009a0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

watchyourlanclient-2024.1009a0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file watchyourlanclient-2024.1009a0.tar.gz.

File metadata

File hashes

Hashes for watchyourlanclient-2024.1009a0.tar.gz
Algorithm Hash digest
SHA256 f22bfda118f13f4b6a41b2e6248237885332e34017575e047054fbc9f89d3c95
MD5 d670d989326e4d9c8a3387ba3b3a71e7
BLAKE2b-256 d994b1ebeff7e52612be15bcbd61f9f522fa2b676a74ca30821e8645fa2ded1d

See more details on using hashes here.

File details

Details for the file watchyourlanclient-2024.1009a0-py3-none-any.whl.

File metadata

File hashes

Hashes for watchyourlanclient-2024.1009a0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c8064d3054d7cdc7d5cfc261db2c3f567f48bc176b34f7d4a08774228e4c6ed
MD5 02251a2b37fcbe1a71a179795a33146c
BLAKE2b-256 d1fdc4636ed153a860dd30af9440357c340aae2ffd12092273c32311acca9ecf

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