Development
This commit is contained in:
parent
e6c5a8136c
commit
ea8a025488
2 changed files with 20 additions and 9 deletions
|
|
@ -22,16 +22,26 @@ try:
|
|||
except Exception:
|
||||
_mac_parser = None
|
||||
|
||||
try:
|
||||
from mac_vendor_lookup import MacLookup as _MacLookup
|
||||
_mac_lookup = _MacLookup()
|
||||
except Exception:
|
||||
_mac_lookup = None
|
||||
|
||||
def _get_vendor(mac):
|
||||
"""Return (short, long) vendor names. long may be empty if no comment available."""
|
||||
if _mac_parser is None:
|
||||
return ('', '')
|
||||
try:
|
||||
short = _mac_parser.get_manuf(mac) or ''
|
||||
long = _mac_parser.get_comment(mac) or ''
|
||||
return (short, long)
|
||||
except Exception:
|
||||
return ('', '')
|
||||
"""Return (short, long) where short is the abbreviated name and long is the full IEEE name."""
|
||||
short, long = '', ''
|
||||
if _mac_parser:
|
||||
try:
|
||||
short = _mac_parser.get_manuf(mac) or ''
|
||||
except Exception:
|
||||
pass
|
||||
if _mac_lookup:
|
||||
try:
|
||||
long = _mac_lookup.lookup(mac) or ''
|
||||
except Exception:
|
||||
pass
|
||||
return (short or long, long)
|
||||
|
||||
def _vendor_html(vendor):
|
||||
short, long = vendor
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
flask
|
||||
bcrypt
|
||||
manuf
|
||||
mac-vendor-lookup
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue