用于xldeploy的python sdk
xldeploy-p的Python项目详细描述
用于XL-Deploy的python sdk。
用法
importxldeployconfig=xldeploy.Config(protocol="http",host="localhost",port="4516",context_path="deployit",username="admin",password="admin")# If you are using urlconfig=xldeploy.Config.initialize(url="http://localhost:4516/deployit",username="admin",password="admin")# If you are using proxiesconfig=xldeploy.Config(protocol="http",host="localhost",port="4516",context_path="deployit",username="admin",password="admin",proxy_host="localhost",proxy_port=8080,proxy_username="proxyUsername",proxy_password="proxyPassword")# orconfig=xldeploy.Config()client=xldeploy.Client(config)# repositoryrepository=client.repositoryprint(repository.exists("Applications/EC2/1.0/ec2"))print(repository.exists("Applications/EC2/1.0/wrong"))ci=repository.read("Applications/EC2/1.0/ec2")print(ci.amiId)# deploymentdeployment=client.deploymentdeploymentRef=deployment.prepare_initial("Applications/NIApp/1.0","Environments/awsEnv")depl=deployment.prepare_auto_deployeds(deploymentRef)task=deployment.create_task(depl)task.start()print(task.task_id)# Deployfile## Apply Deployfile script.importrefromosimportpathdeployfile=client.deployfiledeploy_file=open('deploy_file_path','rb').read()file_names=re.findall('upload\([\'|"](.*)[\'|"]\)',deploy_file.decode("utf-8"))files_to_upload=[path.abspath(path.join(path.abspath(path.join(file_path,"..")),name))fornameinfile_names]deployfile.apply('deploy_file_path',files_to_upload)## POST of multiple multipart-encoded binary filesBasedonPython[requests](https://pypi.python.org/pypi/requests)module,see[docs](http://docs.python-requests.org/en/master/user/advanced/#advanced)## Generate Deployfile script.deployfile=client.deployfiledeployfile.generate([Environments/directory1,Environments/directory1])
从pypi存储库安装
$ pip install xldeploy-py
直接从源安装软件包
$ cd xldeploy-py $ pip install --editable .