Searching the Help
To search for information in the Help, type a word or phrase in the Search box. When you enter a group of words, OR is inferred. You can use Boolean operators to refine your search.
Results returned are case insensitive. However, results ranking takes case into account and assigns higher scores to case matches. Therefore, a search for "cats" followed by a search for "Cats" would return the same number of Help topics, but the order in which the topics are listed would be different.
Search for | Example | Results |
---|---|---|
A single word | cat
|
Topics that contain the word "cat". You will also find its grammatical variations, such as "cats". |
A phrase. You can specify that the search results contain a specific phrase. |
"cat food" (quotation marks) |
Topics that contain the literal phrase "cat food" and all its grammatical variations. Without the quotation marks, the query is equivalent to specifying an OR operator, which finds topics with one of the individual words instead of the phrase. |
Search for | Operator | Example |
---|---|---|
Two or more words in the same topic |
|
|
Either word in a topic |
|
|
Topics that do not contain a specific word or phrase |
|
|
Topics that contain one string and do not contain another | ^ (caret) |
cat ^ mouse
|
A combination of search types | ( ) parentheses |
|
Pytwist details
This section describes the behavior and syntax that is specific to Pytwist.
Authentication modes
The authentication mode of a Pytwist client is important because it affects the SA features and the resources that the client can access. A Pytwist client can run in one of the following modes:
- Authenticated: The client has called the
authenticate(username, password)
method on aTwistServer
object. After calling theauthenticate
method, the client is authorized as the SA user specified by theusername
parameter, much like an end user who logs onto the SA Client. - Not Authenticated: The client has not called the
TwistServer.authenticate
method. On a managed server, the client is authenticated as if it is the device that controls the Agent certificate. When used within a custom extension, a non-authenticated Pytwist client needs access to the Command Engine certificate. For more information on custom extensions and certificates, contact your technical support representative.
TwistServer method syntax
The TwistServer
method configures the connection from the client to the Web Services Data Access Engine. (For sample invocations, see Pytwist examples.) All of the arguments of TwistServer
aroptional. The following table lists the default values for the arguments.
Argument |
Description |
Default |
---|---|---|
host |
The hostname to connect to. |
twist |
port |
The port number to connect to. |
1032 |
secure |
Whether to use https for the connection. Allowed values: 1 (true) or 0 (false). |
1 |
ctx |
The SSL context for the connection. |
None. (See Authentication modes.) |
When the TwistServer
object is created, the client does not establish a connection with the server. Therefore, if a connectivity problem occurs, it is not encountered until the client calls authenticate
or an SA API method.
Error handling
If the TwistServer.authenticate
method or an SA API method encounters a problem, a Python exception is raised. You can catch these exceptions in an except
clause, as in the following example:
# Create the TwistServer object. ts = twistserver.TwistServer(’localhost’) # Authenticate by passing an SA user name and password. try: ts.authenticate(’jdoe’, ’secretpass’) except: print "Authentication failed." sys.exit(2)
Mapping Java package names and data types to Pytwist
The Pytwist interface is for Python, but the SA API is written in Java. Because of the differences between two programming languages a Pytwist client must follow the mapping rules described in this section.
In the SA API documentation, Java package names begin with com.opsware
. When specifying the package name in Pytwist, insert pytwist
at the beginning, for example:
from pytwist.com.opsware.compliance.sco import *
The SA API documentation specifies method parameters and return values as Java data types. The following table shows how to map the Java data types to Python for the API method invocations in Pytwist.
Java data type in SA API |
Python data type in Pytwist |
---|---|
|
An integer 1 for true or the integer 0 for false. |
|
As input parameters to API method calls, object arrays can be either Python tuples or lists. As output from API method calls, object arrays are returned as Python tuples. |
Map |
Dictionary |
|
A |
We welcome your comments!
To open the configured email client on this computer, open an email window.
Otherwise, copy the information below to a web mail client, and send this email to hpe_sa_docs@hpe.com.
Help Topic ID:
Product:
Topic Title:
Feedback: