Skip to main content

Generated Python Client for Humanitec API

Project description

Unofficial Client for Humanitec API

Based on generated client with swagger-codegen. Contains a few tweaks to tackle generation bugs from swagger-codegen. Full generated documentation of generated client.

This is for testing only. If you need to use a python-client in production, rather generate maintain one by yourself.

However, if you just need a python module ready to access Humanitec API, run:

pip install unofficial-humanitec-client

Official Humanitec API Documentation

See official documentation for information provided directly by Humanitec.

License

The original openapi specification is published under Apache 2 license. This generated client is published under EUROPEAN UNION PUBLIC LICENCE v. 1.2


Trouble Shooting

Authentication

Unfortunately, there is mix of missing security schemes in the original Humanitec specification (from version 0.24.1 on) and several bug in the swagger-codegen breaking the use of bearer authentication. As workaround use the folloying snippet:

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

Use that api_client as base client for every api_instance you create, i.e.

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)

Invalid value for '', must not be 'None'

Some endpoints cannot deal with null values. On the one side nullable fields are missing from the original Humanitec specification (0.24.1), but even when added, swagger-codegen still makes all fields required.

Known endpoints running in to this bug are delta endpoints. In that case, you have to rely on reuests module, which begs the question why using a generated client at all...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unofficial-humanitec-client-0.1.1.tar.gz (238.5 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page