Skip to content

Commit

Permalink
Initial attempt at adding PyPi documentation for the next release
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimian committed May 31, 2015
1 parent bbfbf48 commit da16cd7
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ session.set('sysLocation.0', 'The SNMP Lab')
# Perform an SNMP walk
system_items = session.walk('system')

# Each returned item can be used normally as its related type (str or int) but
# also has several extended attributes with SNMP-specific information
# Each returned item can be used normally as its related type (str or int)
# but also has several extended attributes with SNMP-specific information
for item in system_items:
print '{oid}.{oid_index} {snmp_type} = {value}'.format(
oid=item.oid,
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ are planning on requesting multiple pieces of SNMP data from a source.
# Perform an SNMP walk
system_items = session.walk('system')
# Each returned item can be used normally as its related type (str or int) but
# also has several extended attributes with SNMP-specific information
# Each returned item can be used normally as its related type (str or int)
# but also has several extended attributes with SNMP-specific information
for item in system_items:
print '{oid}.{oid_index} {snmp_type} = {value}'.format(
oid=item.oid,
Expand Down
85 changes: 84 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
"""
Introduction
------------
This is a fork of the official `Net-SNMP Python Bindings`_ but attempts to
bring a more Pythonic interface to the library. Check out the
`Net-SNMP website`_ for more information about SNMP.
This module provides a full featured SNMP client API supporting all dialects
of the SNMP protocol.
.. _Net-SNMP Python Bindings: http://net-snmp.sourceforge.net/wiki/index.php/Python_Bindings
.. _Net-SNMP website: http://www.net-snmp.org/
Quick Start
-----------
There are primarily two ways you can use the Easy SNMP library.
The first is with the use of a Session object which is most suitable when you
are planning on requesting multiple pieces of SNMP data from a source.
.. code-block:: python
from easysnmp import Session
# Create an SNMP session to be used for all our requests
session = Session(hostname='localhost', community='public', version=2)
# You may retrieve an individual OID using an SNMP GET
location = session.get('sysLocation.0')
# You may also specify the OID as a tuple (name, index)
# Note: the index is specified as a string as it can be of other types than
# just a regular integer
contact = session.get(('sysContact', '0'))
# And of course, you may use the numeric OID too
description = session.get('.1.3.6.1.2.1.1.1.0')
# Set a variable using an SNMP SET
session.set('sysLocation.0', 'The SNMP Lab')
# Perform an SNMP walk
system_items = session.walk('system')
# Each returned item can be used normally as its related type (str or int)
# but also has several extended attributes with SNMP-specific information
for item in system_items:
print '{oid}.{oid_index} {snmp_type} = {value}'.format(
oid=item.oid,
oid_index=item.oid_index,
snmp_type=item.snmp_type,
value=item.value
)
You may also use Easy SNMP via its simple interface which is intended for
one-off operations where you wish to specify all details in the request:
.. code-block:: python
from easysnmp import snmp_get, snmp_set, snmp_walk
# Grab a single piece of information using an SNMP GET
snmp_get('sysDescr.0', hostname='localhost', community='public', version=1)
# Perform an SNMP SET to update data
snmp_set(
'sysLocation.0', 'My Cool Place',
hostname='localhost', community='public', version=1
)
# Perform an SNMP walk
snmp_walk('system', hostname='localhost', community='public', version=1)
Documentation
-------------
Please check out the `Easy SNMP documentation at Read the Docs`_.
This includes install instructions for various operating systems.
.. _Easy SNMP documentation at Read the Docs: http://easysnmp.readthedocs.org/
"""

import os
import re
import sys
Expand Down Expand Up @@ -56,7 +139,7 @@ def run_tests(self):

setup(
name='easysnmp',
version='0.1',
version='0.1.1',
description='A blazingly fast and Pythonic SNMP library based on the '
'official Net-SNMP bindings',
author='Fotis Gimian',
Expand Down

0 comments on commit da16cd7

Please sign in to comment.