Skip to main content

Lightweight Synchronous wrapper adapters for PySNMP AsyncIO HLAPI

Project description

pysnmp-sync-adapter

PyPI PyPI download month

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_ARCH environment variable.
  • Supports both IPv4 and IPv6 transport targets via UdpTransportTarget and Udp6TransportTarget.
  • Reuses or creates the default shared event loop (asyncio.get_event_loop()), ensuring integration efficiency.
  • Sync wrappers accept an optional timeout parameter (in seconds) that limits the total execution time using asyncio.wait_for().
  • Minimizes connection overhead by reusing pre-created transport instances when calling create_transport().
  • The add-on parallel_get_sync function executes multiple SNMP GET requests concurrently in a blocking context. It is complemented by cluster_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_wrappers compatibility layer, it supports:
  • Also, through the pysnmp_sync_adapter.cmdgen_wrappers compatibility layer, it runs code written against the cmdgen SNMP library appearing in pysnmp.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysnmp_sync_adapter-1.0.8.tar.gz (20.5 kB view details)

Uploaded Source

File details

Details for the file pysnmp_sync_adapter-1.0.8.tar.gz.

File metadata

  • Download URL: pysnmp_sync_adapter-1.0.8.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for pysnmp_sync_adapter-1.0.8.tar.gz
Algorithm Hash digest
SHA256 b8d77c30ec703ac6cc2c6f4f905ccb7218bcac6fd120f5f574af94ddaaf568f6
MD5 d8ccfdaa6202b73f849b2bbefd577d5d
BLAKE2b-256 ee55868410c7a7979a6a47fab3426eda2bf44dd0be4e78d4c4b5acf0d1eb6080

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page