Python API Overview
NSB's Python client library provides the NSBAppClient and NSBSimClient interfaces for integrating applications and network simulators.
Installationโ
Copy the contents of the python/ directory (including the proto/ subdirectory) to your Python project:
your_project/
โโโ nsb_client.py
โโโ proto/
โ โโโ proto/
โ โโโ nsb_pb2.py
โโโ your_code.py
Or install in development mode:
cd python/
pip install -e .
echo 'export PYTHONPATH="${PYTHONPATH}:/path/to/nsb/python"' >> ~/.zshrc
Install Python dependencies:
pip install -r python/requirements.txt
For the full installation walkthrough (system prerequisites, build steps, verification), see Get Started.
Importโ
import nsb_client as nsb
Reference Pagesโ
| Page | Covers |
|---|---|
| MessageEntry | The object returned by receive(), fetch(), and listen() |
| NSBAppClient | send(), receive(), listen() โ the application-side client |
| NSBSimClient | fetch(), post(), listen() โ the simulator-side client |
| Async Listeners | Full asyncio pattern, test files, and Doxygen generation |