Here's an example that performs a walk (using SNMP v2c) on the system tree, display it with pprint and then changes the sysContact MIBOID (using SNMP v1), displays the result, queries it again and complains if it doesn't matches (assumes that the 'public' community string allows full read/write access to localhost... not a typical nor recommended setup):

  import yapsnmp, pprint

  systemtree = yapsnmp.Session('localhost', version=2).walk('system')

  sess = yapsnmp.Session('localhost')
  result = sess.set(('sysContact.0', 's', 'Zaphod Beeblebrox'))
  print "Here's the result from the set: %s" % result[1]
  if result[1] != sess.get('sysContact.0'):
    print "Somehow, the MIBOID just changed since we set it..."

Yves Perrenoud