This is a Python client for Weblogics RESTful Management Services. It takes care of some of the quirks with the API, without being so closely linked that it becomes limiting.
It creates Python objects dynamically based on the response from the server, so that it’s easy to quickly write useful and Pythonic scripts.
It’s tested against 12.2.1.2, but should work fine with all 12c R2 releases.
Installation
$ pipenv install wls-rest-python
Example usage
Explore the API, change properties and undeploy applications:
>>> from wls_rest_python import WLS
>>>
>>> wls = WLS('https://wls.example.com:7001', 'weblogic', 'welcome1')
>>>
>>> dir(wls.edit.batchConfig)
['canonical', 'dynamicallyCreated', 'id', 'identity', 'name', 'notes','parent',
'schemaName', 'self', 'tags', 'type']
>>>
>>> wls.edit.servers.myServer.nativeIOEnabled
True
>>> wls.edit.servers.myServer.update(nativeIOEnabled=False)
>>> wls.edit.servers.myServer.nativeIOEnabled
False
>>> wls.domainRuntime.deploymentManager.appDeploymentRuntimes.myApp.getState(
... target='myServer')
{'return': 'STATE_ACTIVE'}
>>>
>>> wls.domainRuntime.deploymentManager.appDeploymentRuntimes.myApp.undeploy()
>>>
Start all managed servers asynchronously:
from wls_rest_python import WLS
wls = WLS('https://wls.example.com:7001', 'weblogic', 'welcome1')
admin_server_name = wls.edit.adminServerName
running_jobs = []
for server in wls.domainRuntime.serverLifeCycleRuntimes:
if server.name != admin_server_name:
running_jobs.append(server.start(prefer_async=True))
while running_jobs:
for job in running_jobs:
if job.completed:
running_jobs.remove(job)
time.sleep(10)
Undeploy all applications and deploy a new:
import json
from wls_rest_python import WLS
wls = WLS('https://wls.example.com:7001', 'weblogic', 'welcome1')
for deployment in wls.edit.appDeployments:
deployment.delete()
deployment_model = {
'name': 'myWebApp',
'targets': [
{'identity': [
'servers',
'myServer'
]
}
]
}
deployment_info = {
'model': (None, json.dumps(deployment_model)),
'sourcePath': open('/u01/wars/myWebApp.war', 'rb'),
'planPath': open('/u01/wars/myWebAppPlan.xml', 'rb')
}
wls.edit.appDeployments.create(files=deployment_info)
Release files for wls-rest-python 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wls-rest-python-0.1.1.tar.gz | 6.0 kB | Details |
Release files / wls-rest-python-0.1.1.tar.gz
| Download URL | wls-rest-python-0.1.1.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8531384adcc91a9df9d29ef146a5a3aa13f8bc56665d58c9c6cdba810d96ebb
|
|
BLAKE2b-256 checksum How to use checksums |
5c4b6b338656578446b950063afd3c778c0c220f6402f7f03f24e7497a1d4c11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |