Development

This commit is contained in:
Matthew Grotke 2026-06-02 00:03:08 -04:00
parent e6c5a8136c
commit ea8a025488
2 changed files with 20 additions and 9 deletions

View file

@ -22,16 +22,26 @@ try:
except Exception: except Exception:
_mac_parser = None _mac_parser = None
try:
from mac_vendor_lookup import MacLookup as _MacLookup
_mac_lookup = _MacLookup()
except Exception:
_mac_lookup = None
def _get_vendor(mac): def _get_vendor(mac):
"""Return (short, long) vendor names. long may be empty if no comment available.""" """Return (short, long) where short is the abbreviated name and long is the full IEEE name."""
if _mac_parser is None: short, long = '', ''
return ('', '') if _mac_parser:
try: try:
short = _mac_parser.get_manuf(mac) or '' short = _mac_parser.get_manuf(mac) or ''
long = _mac_parser.get_comment(mac) or '' except Exception:
return (short, long) pass
except Exception: if _mac_lookup:
return ('', '') try:
long = _mac_lookup.lookup(mac) or ''
except Exception:
pass
return (short or long, long)
def _vendor_html(vendor): def _vendor_html(vendor):
short, long = vendor short, long = vendor

View file

@ -1,3 +1,4 @@
flask flask
bcrypt bcrypt
manuf manuf
mac-vendor-lookup