From 6bf100ab04d65041b9b194cab0cda76d8effe4fe Mon Sep 17 00:00:00 2001 From: Simon Reeves Date: Wed, 10 May 2023 11:31:22 +0100 Subject: [PATCH] smp settings replacing getenv --- an_farmview/snmp.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/an_farmview/snmp.py b/an_farmview/snmp.py index f944270..a3a3b8e 100644 --- a/an_farmview/snmp.py +++ b/an_farmview/snmp.py @@ -1,4 +1,3 @@ -import os import pysnmp.hlapi from .config import settings @@ -10,8 +9,8 @@ def get_sensor(oid): iterator = pysnmp.hlapi.getCmd( pysnmp.hlapi.SnmpEngine(), - pysnmp.hlapi.CommunityData(os.getenv('SNMP_COMMUNITY')), - pysnmp.hlapi.UdpTransportTarget((os.getenv('SNMP_IP'), 161)), + pysnmp.hlapi.CommunityData(settings.snmp_community), + pysnmp.hlapi.UdpTransportTarget((settings.snmp_ip, 161)), pysnmp.hlapi.ContextData(), pysnmp.hlapi.ObjectType(pysnmp.hlapi.ObjectIdentity(oid)) )