跳转到主要内容

为Humanitec API生成的Python客户端

项目描述

Humanitec API的非官方客户端

基于swagger-codegen生成的客户端。包含一些调整以解决swagger-codegen的生成错误。请参阅生成的客户端完整文档

这仅用于测试。如果您需要在生产环境中使用python客户端,最好自行生成并维护。

但是,如果您只需要一个可以访问Humanitec API的python模块,请运行

pip install unofficial-humanitec-client

官方Humanitec API文档

请参阅官方文档以获取Humanitec直接提供的信息。

许可证

原始openapi规范在Apache 2许可证下发布。此生成的客户端在欧洲联盟公共许可证v. 1.2下发布


故障排除

身份验证

不幸的是,原始Humanitec规范(从0.24.1版本开始)中存在安全方案缺失的问题,并且swagger-codegen中的几个错误破坏了携带身份验证的使用。作为解决方案,请使用以下片段

configuration = Configuration()
configuration.api_key['Authorization']='<your humanitec api token>'
configuration.api_key_prefix['Authorization']='Bearer'
api_client = swagger_client.ApiClient(configuration=configuration)

将此api_client作为每个创建的api_instance的基础客户端,即

def get_all_apps(org_id: str):
    # Use api_client with bearer authentication configured
    api_instance = swagger_client.ApplicationApi(api_client=api_client)

    try:
        # List all Applications in an Organization.
        api_response = api_instance.orgs_org_id_apps_get(org_id)
        print(api_response)
    except ApiException as e:
        print("Exception when calling ApplicationApi->orgs_org_id_apps_get: %s\n" % e)

''的无效值,不允许为'None'

一些端点无法处理null值。一方面,原始Humanitec规范(0.24.1)中缺少可空字段,即使在添加后,swagger-codegen仍然将所有字段都设置为必需。

已知运行此错误的端点是delta端点。在这种情况下,您必须依赖reuests模块,这引发了为什么还要使用生成的客户端的问题...

项目详情


下载文件

下载适用于您平台的文件。如果您不确定该选择哪个,请了解有关安装包的更多信息。

源分发

unofficial-humanitec-client-0.1.1.tar.gz (238.5 kB 查看哈希值)

上传时间

构建分发

unofficial_humanitec_client-0.1.1-py3-none-any.whl (1.1 MB 查看哈希值)

上传时间 Python 3

支持