PySyncThru


NamePySyncThru JSON
Version 0.8.0 PyPI version JSON
download
home_pagehttps://github.com/nielstron/pysyncthru/
SummaryAutomated JSON API based communication with Samsung SyncThru Web Service
upload_time2023-11-14 23:43:37
maintainer
docs_urlNone
authornielstron
requires_python>=3
licenseMIT
keywords python syncthru json api samsung printer
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # PySyncThru - a very basic python SyncThru bridge
[![Build Status](https://app.travis-ci.com/nielstron/pysyncthru.svg?branch=master)](https://app.travis-ci.com/github/nielstron/pysyncthru)
[![Coverage Status](https://coveralls.io/repos/github/nielstron/pysyncthru/badge.svg?branch=master)](https://coveralls.io/github/nielstron/pysyncthru?branch=master)
[![Package Version](https://img.shields.io/pypi/v/pysyncthru)](https://pypi.org/project/PySyncThru/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pysyncthru.svg)](https://pypi.org/project/PySyncThru/)

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

```python
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())
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nielstron/pysyncthru/",
    "name": "PySyncThru",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "python syncthru json api samsung printer",
    "author": "nielstron",
    "author_email": "n.muendler@web.de",
    "download_url": "https://files.pythonhosted.org/packages/8e/15/c61568c333c16f6f27b89da8ce006ae6dae25f86aee8b96bb27eb3ac8dd5/PySyncThru-0.8.0.tar.gz",
    "platform": null,
    "description": "# PySyncThru - a very basic python SyncThru bridge\n[![Build Status](https://app.travis-ci.com/nielstron/pysyncthru.svg?branch=master)](https://app.travis-ci.com/github/nielstron/pysyncthru)\n[![Coverage Status](https://coveralls.io/repos/github/nielstron/pysyncthru/badge.svg?branch=master)](https://coveralls.io/github/nielstron/pysyncthru?branch=master)\n[![Package Version](https://img.shields.io/pypi/v/pysyncthru)](https://pypi.org/project/PySyncThru/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pysyncthru.svg)](https://pypi.org/project/PySyncThru/)\n\nA package that connects to a Samsung printer in the local network that\nmakes use of the SyncThru web service and provides data\nthat is provided via the JSON API of the device.\nIf the API cannot be reached (because on some printers it is not supported),\nit tries to parse other pages in the webinterface and extract information.\n\nIt is able to read the system, toner and tray status and provides method \nwrappers to access them.\nOverall, the following data is usually provided by the printers:\n\n- Device / System status\n- Drum / Toner status\n- Model name\n- Tray status\n\nSadly it seems like there is no official API, so fixes are welcome and likely \nneeded!\n\n## Usage\n\n```python\nimport aiohttp\nimport asyncio\nfrom pysyncthru import SyncThru\n\nIP_PRINTER = '192.168.0.25'\n\nasync def main():\n    async with aiohttp.ClientSession() as session:\n        printer = SyncThru(IP_PRINTER, session)\n        await printer.update()\n\n        # Is printer online?\n        print(\"Printer online?:\", printer.is_online())\n        # Show the printer status\n        print(\"Printer status:\", printer.device_status())\n        if printer.is_online():\n            # Show details about the printer\n            print(\"Printer model:\", printer.model())\n            # Get the details of a cartridge\n            print(\"Toner Cyan details:\", printer.toner_status()['cyan'])\n            # Get the details about a tray\n            print(\"Tray 1 Capacity:\", printer.input_tray_status()[1]['capa'])\n        # Print all available details from the printer\n        print(\"All data:\\n\", printer.raw())\n        \nloop = asyncio.get_event_loop()\nloop.run_until_complete(main())\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Automated JSON API based communication with Samsung SyncThru Web Service",
    "version": "0.8.0",
    "project_urls": {
        "Homepage": "https://github.com/nielstron/pysyncthru/"
    },
    "split_keywords": [
        "python",
        "syncthru",
        "json",
        "api",
        "samsung",
        "printer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e15c61568c333c16f6f27b89da8ce006ae6dae25f86aee8b96bb27eb3ac8dd5",
                "md5": "013f861388613497be891c55b5056c46",
                "sha256": "d5bccaa23dd6a8e6060873cc1adaf8d94f7a518ead13eae491ebca29dbd28f62"
            },
            "downloads": -1,
            "filename": "PySyncThru-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "013f861388613497be891c55b5056c46",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 7339,
            "upload_time": "2023-11-14T23:43:37",
            "upload_time_iso_8601": "2023-11-14T23:43:37.193616Z",
            "url": "https://files.pythonhosted.org/packages/8e/15/c61568c333c16f6f27b89da8ce006ae6dae25f86aee8b96bb27eb3ac8dd5/PySyncThru-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-14 23:43:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nielstron",
    "github_project": "pysyncthru",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pysyncthru"
}
        
Elapsed time: 0.18039s