Automated JSON API based communication with Samsung SyncThru Web Service
Project description
PySyncThru - a very basic python SyncThru bridge
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
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():
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()[1]['capa'])
# Print all available details from the printer
print("All data:\n", printer.raw())
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file PySyncThru-0.8.0.tar.gz
.
File metadata
- Download URL: PySyncThru-0.8.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5bccaa23dd6a8e6060873cc1adaf8d94f7a518ead13eae491ebca29dbd28f62 |
|
MD5 | 013f861388613497be891c55b5056c46 |
|
BLAKE2b-256 | 8e15c61568c333c16f6f27b89da8ce006ae6dae25f86aee8b96bb27eb3ac8dd5 |