How to add one config file for my WLST python script
<p>I have one script to check the server status. But instead of hard coding the server details like (username,password,url) I would like to give those configuration details in seperate config file. Could some one help me to create one seperate config file to give these server details. Please let me know how to create and how to add in this python file.</p>

<p>I am running the script in WLST using below command:</p>

<pre><code>java -cp $weblogic_path/weblogic.jar  weblogic.WLST Sever_status.py
</code></pre>

<p>Sever_status.py:</p>

<pre><code>try:
    connect('weblogic','Oracle123','https://weblogic.com')
    domainConfig()
    serverList=cmo.getServers();
</code></pre>

<p>First, it is a best practice to encrypt user and password instead of storing them in clear text, even in a separate config file. For this purpose use the </p>

<blockquote>
  <p>storeUserConfig()</p>
</blockquote>

<p>method to encrypt and store connection's credentials. Next, use the generated file when connecting to the server.</p>

<p>Read this documentation for details: 
<a href="https://docs.oracle.com/cd/E23943_01/web.1111/e13813/reference.htm#i1064674" rel="nofollow">https://docs.oracle.com/cd/E23943_01/web.1111/e13813/reference.htm#i1064674</a></p>

<p>You can define variables in an external property file and use them in your wlst script :</p>

<blockquote>
  <p>import ConfigParser ... conf = ConfigParser.ConfigParser()<br>
  conf.read(PATH TO YOUR PROPERTIES FILE)<br></p>
</blockquote>

<p>to read a property : </p>

<blockquote>
  <p>val = conf.get("property name")</p>
</blockquote>

python parsing weblogic config wlst