蟒蛇界面库
pminterface的Python项目详细描述
这是一个简单的python库,旨在在paasmaker中读取 容器的配置,返回到自定义配置 文件正在开发中。
你可以在 http://paasmaker.org/。
用法
在应用程序启动时创建接口对象。供应 具有要查找重写配置的位置列表的构造函数 用于开发的文件。如果您不需要覆盖配置文件 正在paasmaker中使用开发目录scm。
importpminterfaceinterface=pminterface.PaasmakerInterface(['../my-project.yml'])interface.is_on_paasmaker()# Returns true if on Paasmaker.# Raises NameError if no such service exists.service=interface.get_service('named-service')# service now is a dict of the parameters. Typically this will# have the keys 'hostname', 'username', 'password', etc. Use this# to connect to revelant services.# Get other application metadata.application=interface.get_application_name()
重写配置文件可以是yaml或json格式。如果使用 yaml格式,请确保首先安装pyyaml。如果pyyaml不存在, 只支持json格式,当 正在尝试读取yaml文件。
示例yaml配置文件:
services:parameters:foo:barapplication:name:testversion:1workspace:Testworkspace_stub:test
示例json配置文件:
{"services":{"parameters":{"foo":"bar"}},"application":{"name":"test","version":1,"workspace":"Test","workspace_stub":"test"}}
开发
可以使用中的test.py脚本运行单元测试。 根目录。
代码当前存储在BitBucket中的位置:
git@bitbucket.org:paasmaker/paasmaker-interface-python.git
请随意分叉并提交拉动请求。