Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Koos85 committed Sep 26, 2023
1 parent 87f853f commit 79afaf7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion asyncsnmplib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def __init__(
try:
self._priv_proto = PRIV_PROTO[priv_proto]
except KeyError:
raise Exception('Supply valid auth_proto')
raise Exception('Supply valid priv_proto')
if self._priv_proto and not self._auth_proto:
raise Exception('Supply auth_proto')
if self._auth_proto:
Expand Down
7 changes: 6 additions & 1 deletion asyncsnmplib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ async def snmp_queries(
logging.warning(f'invalid snmpv3 client config {address}: {e}')
raise InvalidClientConfigException
elif version == '1':
community = config.get('community', 'public')
if isinstance(community, dict):
community = community.get('secret')
if not isinstance(community, str):
raise TypeError('SNMP community must be a string.')
cl = SnmpV1(
host=address,
community=community,
Expand All @@ -130,7 +135,7 @@ async def snmp_queries(
except Exception as e:
msg = str(e) or type(e).__name__
raise ParseResultException(
f'parse result error: {msg}')
f'Failed to parse result. Exception: {msg}')
else:
results[name] = parsed_result
return results
Expand Down

0 comments on commit 79afaf7

Please sign in to comment.