Không có mô tả

Rob Austein 23cf0d71bb Update to track library changes 4 năm trước cách đây
README.md e7b43fa419 Initial public version. 5 năm trước cách đây
printer_browser.py 23cf0d71bb Update to track library changes 4 năm trước cách đây

README.md

printer-browser.py

Small program to browse the local network for printers via Apple-flavored mDNS (Bonjour), massage the data slightly, and write it out in DNS master file format.

Changes made to the data:

  • We strip off the .local. suffix, because we want to append the local zone $ORIGIN when we drop this text into a master file.

  • We remove the adminurl property, because we don't generally want our users trying to reconfigure our printers anyway.

The target audience for this is the IETF meeting network, but this might conceivably be useful whenever trying to make AirPrint work across multiple network segments.

Most of the work is done by two external packages: zeroconf and dnspython. Both of these are available from PyPi, as well as from various OS-specific packaging systems.

In theory this code is Python-version-agnostic, and should run under either Python 2 or Python 3.

Current usage as of this writing (run with --help for latest):

usage: printer_browser.py [-h] [-q] [-o OUTPUT]
                          [--browse-timeout BROWSE_TIMEOUT]
                          [--query-timeout QUERY_TIMEOUT] [--keep-adminurl]
                          [mdns_type [mdns_type ...]]

Browse for printers on the local net, dump DNS records for inclusion in a DNS
zone in master file format.

positional arguments:
  mdns_type             mDNS types for which to browse (default:
                        ['_ipp._tcp.local.', '_pdl-datastream._tcp.local.'])

optional arguments:
  -h, --help            show this help message and exit
  -q, --quiet           omit comments from generated master file text
                        (default: False)
  -o OUTPUT, --output OUTPUT
                        where to write master file text (default: -)
  --browse-timeout BROWSE_TIMEOUT
                        timeout in seconds while browsing for printers
                        (default: 5)
  --query-timeout QUERY_TIMEOUT
                        timeout in seconds to retrieve printer data (default:
                        3)
  --keep-adminurl       keep adminurl property in generated DNS data (default:
                        False)