%global _empty_manifest_terminate_build 0 Name: python-brother Version: 2.3.0 Release: 1 Summary: Python wrapper for getting data from Brother laser and inkjet printers via SNMP. License: Apache-2.0 License URL: https://github.com/bieniu/brother Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c0/c2/67922bcbd0479f6e35b2b387eda4afbd53db2312f068dd79763bf363fa36/brother-2.3.0.tar.gz BuildArch: noarch Requires: python3-dacite Requires: python3-pysnmplib %description [![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] # 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 %package -n python3-brother Summary: Python wrapper for getting data from Brother laser and inkjet printers via SNMP. Provides: python-brother BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-brother [![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] # 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 %package help Summary: Development documents and examples for brother Provides: python3-brother-doc %description help [![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] # 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 %prep %autosetup -n brother-2.3.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-brother -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri Apr 21 2023 Python_Bot - 2.3.0-1 - Package Spec generated