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

get session from manager #62

Closed
cbueche opened this issue Nov 29, 2016 · 4 comments
Closed

get session from manager #62

cbueche opened this issue Nov 29, 2016 · 4 comments

Comments

@cbueche
Copy link

cbueche commented Nov 29, 2016

This is not really an issue but more a question: if I create a manager using something like this m = M(host=devicename, community=...) but I need the session to do a session.get() or session.walkmore(), how can I recover it ?

I'm using session = m._session._session but it looks a bit ugly to me. Any advice ?

@vincentbernat
Copy link
Owner

I don't see why you would need to have _session._session. But otherwise, no, there is no better way.

@cbueche
Copy link
Author

cbueche commented Nov 29, 2016

Thank you Vincent for your quick answer, I should have explained me better. The reason is, (within Agent-Jones) for 99% of my SNMP get and set, I use MIBs and the pythonic interface:

for index, operstatus in m.ifOperStatus.iteritems(): use(index & operstatus)

but in one place, I want to allow a SNMP get/walk on an oid passed as parameter :

http://url/aj/api/v1/oidpump/192.168.20.60/get/1.3.6.1.2.1.1.3.0 http://url/aj/api/v1/oidpump/192.168.20.60/walk/1.3.6.1.2.1.31.1.1.1.1

Or Is there a way to do this using a manager ?

@vincentbernat
Copy link
Owner

That's not possible with the manager. So, your way of doing it is the better way. I don't want to provide an "official" way because it would mean that I have to maintain some stability guarantee on the session API. I didn't intend for people to use it (but many do).

@cbueche
Copy link
Author

cbueche commented Nov 29, 2016

That's ok, I can live with this workaround. Thanks again for your support !

@cbueche cbueche closed this as completed Nov 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants