Google

LINK="#0000bb" VLINK="#551a8b" ALINK="#ff0000">

Example of GetRequest object usage

>>> from pysnmp.proto import v1
>>> req = v1.GetRequest()
>>> repr(req)
"GetRequest(version=Version(0), community=Community('public'), pdu=Pdus(get_request=GetRequestPdu(request_id=RequestId(0L), error_status=ErrorStatus(0), error_index=ErrorIndex(0), variable_bindings=VarBindList())))"
>>> req['community'].set('mycomm')
>>> req['pdu']['get_request']['variable_bindings'].append(v1.VarBind(name=v1.ObjectName('1.3.6.1.2.1.1.1.0')))
>>> req.encode()
'0&\002\001\000\004\006mycomm\240\031\002\001\000\002\001\000\002\001\0000\0160\014\006\010+\006\001\002\001\001\001\000\005\000'
>>> req.reply()
GetResponse(version=Version(0), community=Community('mycomm'), pdu=Pdus(get_response=GetResponsePdu(request_id=RequestId(0L), error_status=ErrorStatus(0), error_index=ErrorIndex(0), variable_bindings=VarBindList(VarBind(name=ObjectName('.1.3.6.1.2.1.1.1.0'), value=ObjectSyntax(simple=SimpleSyntax(empty=Null(None))))))))
>>>


ilya@glas.net