### Pyncthing Usage Example Source: https://github.com/salamandar/pyncthing/blob/main/README.md Demonstrates how to initialize the Syncthing client, set an API key, and make calls to various Syncthing API endpoints like system status, paths, folder configuration, and event streams. ```Python from pyncthing import Syncthing sync = Syncthing("http://localhost:8384/rest") # This endpoint does not need authentication assert sync.noauth.health() # This does NOT check for authentication errors. sync.set_api_key("") print(sync.system.status()) for name, path in sync.system.paths(): print(f"System path {name} is {path}") for folder in sync.config.folders().get(): print(folder["id"], folder["label"]) # This call is blocking! # Even next() might block if no event is coming. # You can stop blocked calls with sync.events.stop(). # Carefull, it blocks *all* calls! # This API will probably change in the future. for event in sync.events(): print(event) ``` -------------------------------- ### Syncthing REST API Endpoints Source: https://github.com/salamandar/pyncthing/blob/main/README.md Exposes common Syncthing REST API endpoints as methods within the pyncthing client. Includes health checks, system information, configuration retrieval, and event streaming. ```APIDOC Syncthing Client Initialization: Syncthing(base_url: str) Initializes the client with the Syncthing REST API base URL. set_api_key(api_key: str) Sets the API key for authenticated requests. No Authentication Endpoints: noauth.health() Checks the health status of the Syncthing instance. Does not require authentication. Returns: A dictionary indicating health status. System Endpoints: system.status() Retrieves the current status of the Syncthing system. Returns: A dictionary containing system status information. system.paths() Retrieves the system paths configured in Syncthing. Returns: A dictionary mapping path names to their file system paths. Configuration Endpoints: config.folders() Retrieves the list of configured folders. Returns: A list of dictionaries, where each dictionary represents a folder configuration. Event Endpoints: events() Streams events from the Syncthing instance. This call is blocking. Returns: An iterator yielding event dictionaries. Related: sync.events.stop() to stop the event stream. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.