Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using timeout and retry #38

Closed
mehrnazd opened this issue Dec 25, 2023 · 1 comment
Closed

using timeout and retry #38

mehrnazd opened this issue Dec 25, 2023 · 1 comment
Labels
area:pysnmp PySNMP package enhancement New feature or request

Comments

@mehrnazd
Copy link

previously, we could pass timeout and retries as parameters to the UdpTransportTarget in getCmd.
for example:

UdpTransportTarget(('demo.snmplabs.com', 161), timeout=8.0, retries=0)

but in the new function,Slim.get, the only parameters that can be passed are address and port. and of course, it raises an Error:

    errorIndication, errorStatus, errorIndex, varBinds = await slim.get(
  File "/lib/python3.10/site-packages/pysnmp/hlapi/asyncio/slim.py", line 108, in get
    return await getCmd(
  File "/lib/python3.10/site-packages/pysnmp/hlapi/asyncio/cmdgen.py", line 155, in getCmd
    vbProcessor.makeVarBinds(snmpEngine, varBinds), __cbFun,
  File "/lib/python3.10/site-packages/pysnmp/hlapi/varbinds.py", line 32, in makeVarBinds
    elif isinstance(varBind[0], ObjectIdentity):
TypeError: 'int' object is not subscriptable

my question is how to use timeout and reties in Slim.get.

thanks

@lextm lextm closed this as completed in 086ddc7 Dec 25, 2023
@lextm
Copy link

lextm commented Dec 25, 2023

Thanks. The two arguments were not considered initially but added now in release 5.0.32,

https://github.com/lextudio/pysnmp/blob/v5.0.32/pysnmp/hlapi/asyncio/slim.py#L47

You can simply add the values you like to use when calling slim.get.

@lextm lextm added enhancement New feature or request area:pysnmp PySNMP package labels Dec 25, 2023
lextm added a commit that referenced this issue Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pysnmp PySNMP package enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants