#Rest API session or cookie or whatever?

1 messages · Page 1 of 1 (latest)

fierce ledge
#

Is there a way to authenticate and keep the session open for a period of time? I use python, so do I need to switch to session() vs. just requests?

tawny shale
#

I believe using the NetApp.ONTAP python module, the connect function creates a global connection object.

#

@ebon oar Thinking of the threading issues (using the 'with' context manager) in the past, this connection object existing globally was the crux of that issue.

fierce ledge
#

I know you can get a session when you login to docs/API. So why can't I do the same for normal API.

marsh comet
fierce ledge
marsh comet
#

Ah, sorry. Haven't done that myself I'm afraid. You could check the host_connection.py code from the netapp-ontap library. At it's core it's probably using standard modules like urllib.

fierce ledge
#

Oh man, I thought these were the same as ontapi/zapi that was going away. I may have to leverage this module now.

raven trellis
# fierce ledge I don't want to use any other modules other than say requests and urllib2/3 is i...

the REST API can be used like any other REST API, you don't need any fancy library for that. But many functions are not yet exposed through the REST API and rely on the old ZAPI, which the netapp-ontap module transparently handles for you. Of course you can also use ZAPI without any library (it's XMLRPC after all) but I don't know how much time you want to pour into this just so that you "don't have to use the netapp-ontap module".
I mean you can also get rid of urllib and requests if you want, but what's the point?