Introduction

LocalSend Python is an unofficial, synchronous Python client for the LocalSend v2 protocol. Use it to discover LocalSend peers, send files, accept incoming files, and publish browser-download links.

Install

Install the package in your project:

uv add localsend-python

Use devices on the same LAN, with LocalSend running on the peer. Discovery and transfers must be allowed through each device’s firewall. The library uses the standard LocalSend HTTP port, 53317, by default.

Client lifecycle

Create a Client, start it before discovering, receiving, or sharing, and close it when finished. A context manager handles that lifecycle:

from localsend import Client

with Client("My Python client") as client:
    peers = client.devices
    # Register a peer or send files while the client is running.

devices is populated as peers are discovered. See the Public API for all public models, errors, and transfer methods.

The guides point to runnable examples for real LocalSend devices.

Logging

LocalSend Python emits standard-library logging records under the localsend namespace without configuring application logging. Configure that logger in your application as needed:

import logging

logging.basicConfig(level=logging.INFO)
logging.getLogger("localsend").setLevel(logging.DEBUG)