Metadata-Version: 2.4
Name: brother
Version: 5.0.1
Summary: Python wrapper for getting data from Brother laser and inkjet printers via SNMP.
Author: Maciej Bieniek
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/bieniu/brother
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dacite>=1.7.0
Requires-Dist: pysnmp>=7.1.6
Provides-Extra: test
Requires-Dist: coverage==7.10.4; extra == "test"
Requires-Dist: freezegun==1.5.5; extra == "test"
Requires-Dist: mypy==1.17.1; extra == "test"
Requires-Dist: pytest-asyncio==1.1.0; extra == "test"
Requires-Dist: pytest-cov==6.2.1; extra == "test"
Requires-Dist: pytest-error-for-skips==2.0.2; extra == "test"
Requires-Dist: pytest-timeout==2.4.0; extra == "test"
Requires-Dist: pytest==8.4.1; extra == "test"
Requires-Dist: ruff==0.12.9; extra == "test"
Requires-Dist: syrupy==4.9.1; extra == "test"
Provides-Extra: dev
Requires-Dist: pre-commit==4.3.0; extra == "dev"
Dynamic: license-file

[![GitHub Release][releases-shield]][releases]
[![PyPI][pypi-releases-shield]][pypi-releases]
[![PyPI - Downloads][pypi-downloads]][pypi-statistics]
[![Buy me a coffee][buy-me-a-coffee-shield]][buy-me-a-coffee]
[![PayPal_Me][paypal-me-shield]][paypal-me]
[![Revolut.Me][revolut-me-shield]][revolut-me]

# brother

Python wrapper for getting data from Brother laser and inkjet printers via snmp

## How to use package

```py
import asyncio
import logging
from sys import argv

import pysnmp.hlapi.asyncio as hlapi

from brother import Brother, SnmpError, UnsupportedModelError

# printer IP address/hostname
HOST = "brother"
logging.basicConfig(level=logging.DEBUG)


async def main():
    host = argv[1] if len(argv) > 1 else HOST
    printer_type = argv[2] if len(argv) > 2 else "laser"
    # argument printer_type: laser - for laser printer
    #                        ink   - for inkjet printer

    external_snmp = False
    if len(argv) > 3 and argv[3] == "use_external_snmp":
        external_snmp = True

    if external_snmp:
        print("Using external SNMP engine")
        snmp_engine = hlapi.SnmpEngine()
    else:
        snmp_engine = None
    try:
        brother = await Brother.create(
            host, printer_type=printer_type, snmp_engine=snmp_engine
        )
        data = await brother.async_update()
    except (ConnectionError, SnmpError, UnsupportedModelError) as error:
        print(f"{error}")
        return

    brother.shutdown()

    print(f"Model: {brother.model}")
    print(f"Firmware: {brother.firmware}")
    if data:
        print(f"Status: {data.status}")
        print(f"Serial no: {data.serial}")
        print(f"Sensors data: {data}")


loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()
```

[releases]: https://github.com/bieniu/brother/releases
[releases-shield]: https://img.shields.io/github/release/bieniu/brother.svg?style=popout
[pypi-releases]: https://pypi.org/project/brother/
[pypi-statistics]: https://pepy.tech/project/brother
[pypi-releases-shield]: https://img.shields.io/pypi/v/brother
[pypi-downloads]: https://pepy.tech/badge/brother/month
[buy-me-a-coffee-shield]: https://img.shields.io/static/v1.svg?label=%20&message=Buy%20me%20a%20coffee&color=6f4e37&logo=buy%20me%20a%20coffee&logoColor=white
[buy-me-a-coffee]: https://www.buymeacoffee.com/QnLdxeaqO
[paypal-me-shield]: https://img.shields.io/static/v1.svg?label=%20&message=PayPal.Me&logo=paypal
[paypal-me]: https://www.paypal.me/bieniu79
[revolut-me-shield]: https://img.shields.io/static/v1.svg?label=%20&message=Revolut&logo=revolut
[revolut-me]: https://revolut.me/maciejbieniek
