Skip to content

Commit

Permalink
Minimal changes needed to support use in Python 3.x
Browse files Browse the repository at this point in the history
Should also continue to work with Python 2.x
  • Loading branch information
wdennis committed Jan 20, 2015
1 parent 006ad45 commit cc0d834
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions snmp/snmp_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
7465616d'))]
>>> output = snmp_extract(snmp_data)
>>> print output
>>> print(output)
Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.0(1)M4, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2010 by Cisco Systems, Inc.
Expand All @@ -48,7 +48,7 @@
>>> snmp_data = snmp_get_oid_v3(snmp_device, snmp_user, oid=sys_descr)
>>> output = snmp_extract(snmp_data)
>>> print output
>>> print(output)
Cisco IOS Software, C880 Software (C880DATA-UNIVERSALK9-M), Version 15.4(2)T1, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2014 by Cisco Systems, Inc.
Expand Down Expand Up @@ -140,10 +140,10 @@ def snmp_get_oid_v3(snmp_device, snmp_user, oid='.1.3.6.1.2.1.1.1.0', auth_proto
return snmp_data
else:
if display_errors:
print 'ERROR DETECTED: '
print ' %-16s %-60s' % ('error_message', error_detected)
print ' %-16s %-60s' % ('error_status', error_status)
print ' %-16s %-60s' % ('error_index', error_index)
print('ERROR DETECTED: ')
print(' %-16s %-60s' % ('error_message', error_detected))
print(' %-16s %-60s' % ('error_status', error_status))
print(' %-16s %-60s' % ('error_index', error_index))
return None


Expand Down Expand Up @@ -173,10 +173,10 @@ def snmp_get_oid(a_device, oid='.1.3.6.1.2.1.1.1.0', display_errors=False):
return snmp_data
else:
if display_errors:
print 'ERROR DETECTED: '
print ' %-16s %-60s' % ('error_message', error_detected)
print ' %-16s %-60s' % ('error_status', error_status)
print ' %-16s %-60s' % ('error_index', error_index)
print('ERROR DETECTED: ')
print(' %-16s %-60s' % ('error_message', error_detected))
print(' %-16s %-60s' % ('error_status', error_status))
print(' %-16s %-60s' % ('error_index', error_index))
return None


Expand Down

0 comments on commit cc0d834

Please sign in to comment.