Async OUI Lookups
raw JSON → 0.1.9 verified Thu Apr 16 auth: no python
aiooui offers an asynchronous approach to perform Organisationally Unique Identifier (OUI) lookups, enabling efficient identification of vendors based on MAC addresses in Python applications. It supports asynchronous programming models, making it suitable for use in modern Python asynchronous frameworks. The current version is 0.1.9, with a fairly active release cadence, frequently publishing minor updates and bug fixes.
pip install aiooui Common errors
error aiooui.exceptions.OUIError: Failed to load OUI data ↓
cause The OUI data file could not be downloaded or accessed, potentially due to network issues, file permissions, or an unsupported environment (e.g., Windows pathing issues in older versions).
fix
Ensure an active internet connection. If on Windows, update
aiooui to the latest version (pip install --upgrade aiooui). Check your Python environment's permissions for writing to the package's data directory. error RuntimeError: Event loop is closed ↓
cause Attempting to run `aiooui`'s asynchronous functions outside of a running asyncio event loop, or after the loop has been explicitly closed, commonly occurs when mixing sync and async code improperly or when the event loop lifecycle isn't managed correctly.
fix
Always execute
aiooui methods within an async function and run it using asyncio.run(your_async_function()). Avoid calling await outside an async context. If using a framework, ensure proper integration with its async features. Warnings
gotcha On Windows systems, `aiooui` has historically faced issues loading OUI data due to pathing or permissions. Ensure your environment allows the library to download and access necessary data files. ↓
fix Upgrade to `aiooui` v0.1.9 or newer. If issues persist, manually verify file permissions for the `aiooui` data directory in your Python environment or consider running in a WSL/Linux environment.
gotcha The library fetches OUI data from external sources. Intermittent network issues or server unavailability during installation or initial usage can lead to data loading failures. Earlier versions had less robust retry mechanisms. ↓
fix Ensure a stable internet connection during installation and initial runs. If data loading fails, retry the operation. Version 0.1.8 and later include improved retry logic for data fetching.
gotcha Older versions of `aiooui` had a default timeout for fetching OUI data during the build process, which could be too short on slower connections or with large data files, leading to build failures. ↓
fix Upgrade to `aiooui` v0.1.1 or later, which increased the timeout. For persistent issues, ensure sufficient network bandwidth and consider pre-downloading OUI data if the library supports it (check project documentation for advanced usage).
Imports
- OUI
from aiooui import OUI
Quickstart
import asyncio
from aiooui import OUI
async def main():
oui = OUI()
mac_address = '00:08:DC:FF:FF:FF' # Example MAC address (Cisco)
vendor = await oui.lookup(mac_address)
print(f"Vendor for {mac_address}: {vendor}")
# Optionally, look up another known vendor
mac_address_2 = 'F8:F0:05:00:00:00' # Example MAC address (Apple)
vendor_2 = await oui.lookup(mac_address_2)
print(f"Vendor for {mac_address_2}: {vendor_2}")
if __name__ == "__main__":
asyncio.run(main())