Lightweight Synchronous wrapper adapters for PySNMP AsyncIO HLAPI
Project description
pysnmp-sync-adapter
Lightweight Synchronous Adapter for PySNMP AsyncIO HLAPI
This package provides lightweight, blocking wrappers around the pysnmp.hlapi.v1arch.asyncio and pysnmp.hlapi.v3arch.asyncio modules of PySNMP, enabling synchronous use of the SNMP high-level API in PySNMP v7+ without requiring direct asyncio management. It preserves the flexibility of PySNMP’s asyncio-based architecture and includes a compatibility layer for various legacy interfaces. The two additional functions parallel_get_sync and cluster_varbinds enable efficient, high-performance concurrent SNMP queries in a blocking context.
Features
- Drop-in synchronous alternatives to PySNMP's async-HLAPI:
get_cmd_sync,next_cmd_sync,set_cmd_sync,bulk_cmd_sync,walk_cmd_sync,bulk_walk_cmd_sync. - Supports both v1arch and v3arch PySNMP v7+ architectures, automatically selected or configurable via the
PYSNMP_ARCHenvironment variable. - Supports both IPv4 and IPv6 transport targets via
UdpTransportTargetandUdp6TransportTarget. - Reuses or creates the default shared event loop (
asyncio.get_event_loop()), ensuring integration efficiency. - Sync wrappers accept an optional
timeoutparameter (in seconds) that limits the total execution time usingasyncio.wait_for(). - Minimizes connection overhead by reusing pre-created transport instances when calling
create_transport(). - The add-on
parallel_get_syncfunction executes multiple SNMP GET requests concurrently in a blocking context. It is complemented bycluster_varbinds, an ancillary utility that normalizes and clusters OIDs into ordered chunks for efficient batching. Together, they enable high-throughput querying of large OID sets without requiring asyncio, reducing per-PDU overhead while preserving request order. - In addition, through the
pysnmp_sync_adapter.legacy_wrapperscompatibility layer, it supports:- the Python SNMP library v5.0.24 HLAPI
- the
etingof/pysnmpv5 HLAPI
- Also, through
the pysnmp_sync_adapter.cmdgen_wrapperscompatibility layer, it runs code written against thecmdgenSNMP library appearing inpysnmp.entity.rfc3413.oneliner.
These adapters allow to call the familiar HLAPI functions in a purely synchronous style (e.g. in scripts, GUIs like Tkinter, or blocking contexts) without having to manage asyncio directly. This restores the synchronous experience familiar from earlier PySNMP versions. Native sync HLAPI wrappers were deprecated in recent releases in favor of asyncio.
Provided Methods
| Synchronous Function | AsyncIO Equivalent |
|---|---|
get_cmd_sync |
get_cmd |
next_cmd_sync |
next_cmd |
set_cmd_sync |
set_cmd |
bulk_cmd_sync |
bulk_cmd |
walk_cmd_sync |
walk_cmd (async-gen) |
bulk_walk_cmd_sync |
bulk_walk_cmd (async-gen) |
create_transport |
Synchronously awaits the async create() factory on UdpTransportTarget and Udp6TransportTarget |
| Add-on Function | Description |
|---|---|
parallel_get_sync |
Parallel get_cmd |
cluster_varbinds |
Normalize and cluster OID lists |
Full information and usage details at the pysnmp-sync-adapter GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pysnmp_sync_adapter-1.0.7.tar.gz.
File metadata
- Download URL: pysnmp_sync_adapter-1.0.7.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa25c2e9540f9024892f5b638110e406cccdf3d4fa4293d4d9ff47b78a83bf84
|
|
| MD5 |
de47e7e97420ae5e0fe027956b678939
|
|
| BLAKE2b-256 |
9c7db1bc528018133932b5afcb75f66b8cb5026ed0a45b010dc13a50cc783589
|