Skip to content

Commit

Permalink
Revised walk docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Nov 12, 2024
1 parent 50f8e3d commit e391ad5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pysnmp/hlapi/v1arch/asyncio/cmdgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')) ] )
Expand Down Expand Up @@ -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')) ] )
Expand Down
6 changes: 4 additions & 2 deletions pysnmp/hlapi/v3arch/asyncio/cmdgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')) ] )
Expand Down Expand Up @@ -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')) ] )
Expand Down

0 comments on commit e391ad5

Please sign in to comment.