Skip to main content

Automated JSON API based communication with Samsung SyncThru Web Service

Project description

PySyncThru - a very basic python SyncThru bridge

CI Coverage Status Package Version Python Versions

A package that connects to a Samsung printer in the local network that makes use of the SyncThru web service and provides data that is provided via the JSON API of the device. If the API cannot be reached (because on some printers it is not supported), it tries to parse other pages in the webinterface and extract information.

It is able to read the system, toner and tray status and provides method wrappers to access them. Overall, the following data is usually provided by the printers:

  • Device / System status
  • Drum / Toner status
  • Model name
  • Tray status
  • Print / copy counters (if exposed by the counters endpoint)

Sadly it seems like there is no official API, so fixes are welcome and likely needed!

Usage

import aiohttp
import asyncio
from pysyncthru import SyncThru

IP_PRINTER = "192.168.0.25"


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        printer = SyncThru(IP_PRINTER, session)
        await printer.update()

        # Is printer online?
        print("Printer online?:", printer.is_online())
        # Show the printer status
        print("Printer status:", printer.device_status())
        if printer.is_online():
            # Show details about the printer
            print("Printer model:", printer.model())
            # Get the details of a cartridge
            print("Toner Cyan details:", printer.toner_status()["cyan"])
            # Get the details about a tray
            print("Tray 1 Capacity:", printer.input_tray_status()["tray_1"]["capa"])
            # Counter endpoint data (if supported by the device)
            print(f"Print : {printer.print_count()}, Copies: {printer.copy_count()}")
        # Print all available details from the printer
        print("All data:\n", printer.raw())
        print("All counter data:\n", printer.raw_counter())


asyncio.run(main())

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

pysyncthru-0.10.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

pysyncthru-0.10.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file pysyncthru-0.10.1.tar.gz.

File metadata

  • Download URL: pysyncthru-0.10.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysyncthru-0.10.1.tar.gz
Algorithm Hash digest
SHA256 7e68a6146e2e9b219c32e8a68471941ee01add1b88f299b8c61cc98896122bd1
MD5 2d0e2118624242e6321b7603c10bd865
BLAKE2b-256 43704105c759dede5dce24156ad439a58ce2359b0e10c62de7bbb3736e47ec67

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysyncthru-0.10.1.tar.gz:

Publisher: ci.yml on nielstron/pysyncthru

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysyncthru-0.10.1-py3-none-any.whl.

File metadata

  • Download URL: pysyncthru-0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysyncthru-0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b15308b5bad5e9390735d651ce127b28f3485f5393b91c41fda47f8e3c07f43
MD5 0a73260142c570b40148be61e16dc064
BLAKE2b-256 dc2a23cce3128a745edaee9469ad81caaac754a4163cab797f7d56495302d67c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysyncthru-0.10.1-py3-none-any.whl:

Publisher: ci.yml on nielstron/pysyncthru

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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