与Samsung Syncthru Web服务基于JSON API的自动通信
PySyncThru的Python项目详细描述
pysyncthru-一个非常基本的python syncthru桥
连接到本地网络中的三星打印机的软件包 利用syncthru web服务并提供数据 这是通过设备的json api提供的。 它能够读取系统、碳粉和托盘的状态并提供方法 包装器来接近他们。
软件包支持打印机提供的以下数据:
- 设备/系统状态
- 鼓/碳粉状态
- 型号名称
- 托盘状态
遗憾的是,似乎没有正式的api,所以修复是受欢迎的,而且很可能 需要!
如果打印机的语言不是英语,则功能可能无法工作。
用法
importaiohttpimportasynciofrompysyncthruimportSyncThruIP_PRINTER='192.168.0.25'asyncdefmain():asyncwithaiohttp.ClientSession()assession:printer=SyncThru(IP_PRINTER,session)awaitprinter.update()# Is printer online?print("Printer online?:",printer.is_online())# Show the printer statusprint("Printer status:",printer.device_status())ifprinter.is_online():# Show details about the printerprint("Printer model:",printer.model())# Get the details of a cartridgeprint("Toner Cyan details:",printer.toner_status()['cyan'])# Get the details about a trayprint("Tray 1 Capacity:",printer.input_tray_status()[1]['capa'])# Print all available details from the printerprint("All data:\n",printer.raw())loop=asyncio.get_event_loop()loop.run_until_complete(main())
故障排除
如果打印机的一般状态保持为“未知”, 可能是打印机的语言不受支持。
尽管官方支持你的语言 有些状态与库中存储的预期状态不完全匹配。 对于这种情况,请查看语言支持问题模板,以了解有关如何添加打印机支持的详细说明 或者公开一个一般性问题。
当前支持的语言为:英语