Python enabler for Zowe API Mediation Layer
Project description
Onboarding Python enabler for Zowe API Mediation Layer
This is the onboarding Python enabler for Zowe API Mediation Layer (part of Zowe) that allows to register a Python based service to the API Mediation Layer Discovery Service. It uses py-eureka-client.
Installation
Install the package using pip:
pip install zowe-apiml-onboarding-enabler-python
How to use
-
Import the Enabler in Your Python Service. Add the following code block to register your service with Eureka:
Example:
from fastapi import FastAPI from zowe_apiml_onboarding_enabler_python.registration import PythonEnabler app = FastAPI() enabler = PythonEnabler(config_file="service-configuration.yml") @app.on_event("startup") def register_service(): enabler.register()
To make sure that your application will automatically unregister from Eureka once shut down, you can use the
unregister()function, like shown in the example below.@app.on_event("shutdown") def unregister_service(): enabler.unregister()
-
Create a yaml file named
service-configuration.yml, add the configuration properties and place the yaml file inside a/configdirectory at the same level of yourapp.py. Below is an example of the configuration.Example:
eureka: ssl: true host: localhost ipAddress: 127.0.0.1 port: 10011 servicePath: '/eureka' maxRetries: 30 requestRetryDelay: 1000 registryFetchInterval: 5 instance: app: pythonservice scheme: https vipAddress: pythonservice instanceId: localhost:pythonservice:10018 homePageUrl: https://localhost:10018/pythonservice hostName: 'localhost' ipAddr: '127.0.0.1' port: 10018 securePort: 10018 secureVipAddress: pythonservice statusPageUrl: https://localhost:10018/pythonservice/application/info healthCheckUrl: https://localhost:10018/pythonservice/application/health nonSecurePortEnabled': false securePortEnabled: true metadata: apiml.catalog.tile.id: 'cademoapps' apiml.catalog.tile.title: 'Sample Python Hello World' apiml.catalog.tile.description: 'Applications Hello' apiml.routes.api_v1.gatewayUrl: "api/v1" apiml.routes.api_v1.serviceUrl: "/pythonservice" apiml.apiInfo.0.apiId: org.zowe.pythonservice apiml.apiInfo.0.gatewayUrl: "api/v1" apiml.apiInfo.0.swaggerUrl: https://localhost:10018/pythonservice/apidoc apiml.apiInfo.0.version: 1.0.0 apiml.service.title: 'Zowe Sample Python Service' apiml.service.description: 'Sample API services to demonstrate Python Onboarding Enabler' ssl: certificate: ../keystore/localhost/localhost.keystore.cer keystore: ../keystore/localhost/localhost.keystore.key caFile: ../keystore/localhost/localhost.pem keyPassword: password
-
Start your Python service and verify that it registers to the Zowe API Mediation Layer.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zowe_apiml_onboarding_enabler_python-3.2.3.tar.gz.
File metadata
- Download URL: zowe_apiml_onboarding_enabler_python-3.2.3.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
766dfe1598c09e401e3ddb976302f211067c630dc89aaffbbaa7edbe76fe7640
|
|
| MD5 |
e766c30b5f94a157d71e2be131c75c5c
|
|
| BLAKE2b-256 |
2eb20407270fdc814a33db06ad137c8ec625ec16137cdb5a4a1ea83424435e4a
|
File details
Details for the file zowe_apiml_onboarding_enabler_python-3.2.3-py3-none-any.whl.
File metadata
- Download URL: zowe_apiml_onboarding_enabler_python-3.2.3-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af32e4ac73d43eec3f2d268b5bb56c07f50df76266404a207d770633220f924e
|
|
| MD5 |
1c695cfd9bfe84678cea3d04143f2867
|
|
| BLAKE2b-256 |
c3c87be41b7740c6f15d04675fae8549521e3402f9552f2617b1e11e30bca0f3
|