Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bieniu/brother
Python wrapper for getting data from Brother laser and inkjet printers via snmp
https://github.com/bieniu/brother
brother hacktoberfest inkjet-printer laser-printer printer python snmp
Last synced: 4 days ago
JSON representation
Python wrapper for getting data from Brother laser and inkjet printers via snmp
- Host: GitHub
- URL: https://github.com/bieniu/brother
- Owner: bieniu
- License: apache-2.0
- Created: 2019-11-14T18:55:29.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T04:43:07.000Z (8 months ago)
- Last Synced: 2024-04-12T12:16:57.870Z (8 months ago)
- Topics: brother, hacktoberfest, inkjet-printer, laser-printer, printer, python, snmp
- Language: Python
- Homepage:
- Size: 496 KB
- Stars: 13
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![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 argvimport 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 printerexternal_snmp = False
if len(argv) > 3 and argv[3] == "use_external_snmp":
external_snmp = Trueif 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}")
returnbrother.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