The class has the same API as CRTSession so that no modifications are needed to run a script directly. This is usefulfor debugging because you can run your script along with the IDE debugging tools while simulating the interactions withSecureCRT. The primary subclass is called “CRTSession” which is specific to interacting with the Python API for SecureCRT.Whenever a script is launched from SecureCRT, this class should be used to interact with SecureCRT.Ī second subclass called “DebugSession” is used to run scripts outside of SecureCRT, such as in an IDE. The base class is named “Session” is the parent for more specific session types and includes all methods that must beimplemented by all sub-classes.
#Securecrt 8.5.2 send command to all sessions code
As with the Scriptclass, there is also a DebugSession class as a part of this module to allow running the code by the local pythoninterpreter so that the scripts can be debugged. These classes are intended as a wrapper around the SecureCRT Python API tosimplify common tasks that are performed against network devices such as routers and switches. To some degree, asession object can be thought of as a tab in SecureCRT, since you can disconnect from a device and then connect toothers with the same session object. This module includes a collection of “session” objects that represent a session to a remote device. The attributes and methods defined with these classes are more “global” in nature, meaning that they focus on either the interaction with the application, or anything that is common to the entire script regardless of how many sessions (in tabs) are open to remote devices. This module contains classes for representing the execution of a script in SecureCRT. Getcommandoutput and it will execute differently but appropriately for. Because the script file has the code (if you used the provided templates, at least) that detects which program is executing it (SecureCRT or Python directly) and selects the appropriate class type to use, you can write your scripts once with the same method names (e.g.