From 9b8c14d6092e34439754210930cf247446aafb6b Mon Sep 17 00:00:00 2001 From: Lex Li Date: Mon, 11 Nov 2024 21:01:10 -0500 Subject: [PATCH] Revised walk docs. --- pysnmp/hlapi/v1arch/asyncio/cmdgen.py | 6 ++++-- pysnmp/hlapi/v3arch/asyncio/cmdgen.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pysnmp/hlapi/v1arch/asyncio/cmdgen.py b/pysnmp/hlapi/v1arch/asyncio/cmdgen.py index 1cdd937c..9fb0fac2 100644 --- a/pysnmp/hlapi/v1arch/asyncio/cmdgen.py +++ b/pysnmp/hlapi/v1arch/asyncio/cmdgen.py @@ -705,10 +705,11 @@ async def walk_cmd( Examples -------- >>> from pysnmp.hlapi.v1arch.asyncio import * - >>> g = await walk_cmd(SnmpEngine(), + >>> objects = walk_cmd(SnmpEngine(), ... CommunityData('public'), ... await UdpTransportTarget.create(('demo.pysnmp.com', 161)), ... ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr'))) + ... g = [item async for item in objects] >>> next(g) (None, 0, 0, [ObjectType(ObjectIdentity(ObjectName('1.3.6.1.2.1.1.1.0')), DisplayString('SunOS zeus.pysnmp.com 4.1.3_U1 1 sun4m'))]) >>> g.send( [ ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets')) ] ) @@ -902,11 +903,12 @@ async def bulk_walk_cmd( Examples -------- >>> from pysnmp.hlapi.v1arch.asyncio import * - >>> g = await bulk_walk_cmd(SnmpEngine(), + >>> objects = bulk_walk_cmd(SnmpEngine(), ... CommunityData('public'), ... await UdpTransportTarget.create(('demo.pysnmp.com', 161)), ... 0, 25, ... ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr'))) + ... g = [item async for item in objects] >>> next(g) (None, 0, 0, [ObjectType(ObjectIdentity(ObjectName('1.3.6.1.2.1.1.1.0')), DisplayString('SunOS zeus.pysnmp.com 4.1.3_U1 1 sun4m'))]) >>> g.send( [ ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets')) ] ) diff --git a/pysnmp/hlapi/v3arch/asyncio/cmdgen.py b/pysnmp/hlapi/v3arch/asyncio/cmdgen.py index daefbfa3..66018d25 100644 --- a/pysnmp/hlapi/v3arch/asyncio/cmdgen.py +++ b/pysnmp/hlapi/v3arch/asyncio/cmdgen.py @@ -707,11 +707,12 @@ async def walk_cmd( Examples -------- >>> from pysnmp.hlapi.v3arch.asyncio import * - >>> g = await walk_cmd(SnmpEngine(), + >>> objects = walk_cmd(SnmpEngine(), ... CommunityData('public'), ... await UdpTransportTarget.create(('demo.pysnmp.com', 161)), ... ContextData(), ... ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr'))) + ... g = [item async for item in objects] >>> next(g) (None, 0, 0, [ObjectType(ObjectIdentity(ObjectName('1.3.6.1.2.1.1.1.0')), DisplayString('SunOS zeus.pysnmp.com 4.1.3_U1 1 sun4m'))]) >>> g.send( [ ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets')) ] ) @@ -910,12 +911,13 @@ async def bulk_walk_cmd( Examples -------- >>> from pysnmp.hlapi.v3arch.asyncio import * - >>> g = await bulk_walk_cmd(SnmpEngine(), + >>> objects = bulk_walk_cmd(SnmpEngine(), ... CommunityData('public'), ... await UdpTransportTarget.create(('demo.pysnmp.com', 161)), ... ContextData(), ... 0, 25, ... ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr'))) + ... g = [item async for item in objects] >>> next(g) (None, 0, 0, [ObjectType(ObjectIdentity(ObjectName('1.3.6.1.2.1.1.1.0')), DisplayString('SunOS zeus.pysnmp.com 4.1.3_U1 1 sun4m'))]) >>> g.send( [ ObjectType(ObjectIdentity('IF-MIB', 'ifInOctets')) ] )