commit | 8d56d7b06944c5aa58033bafdd4478cc465e9c58 | [log] [tgz] |
---|---|---|
author | Sumit Maheshwari <msumit@users.noreply.github.com> | Wed Apr 14 17:56:01 2021 +0530 |
committer | GitHub <noreply@github.com> | Wed Apr 14 17:56:01 2021 +0530 |
tree | 9021216e8c1c7f12bc56187b0b0819b584d26a74 | |
parent | 57162413d75ff5d106553c2842a683a0db99abbe [diff] |
Rename airflow-client to apache-airflow-client (#12)
Python >= 3.6
You can install directly using pip:
pip install git+https://github.com/apache/airflow-client-python.git
Or install via Setuptools.
git clone git@github.com:apache/airflow-client-python.git cd airflow-client-python python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import airflow_client.client
Please follow the installation procedure and then run the following:
import airflow_client.client from pprint import pprint from airflow_client.client.api import config_api # The client must use the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # # In case of the basic authentication below, make sure that Airflow is # configured with the basic_auth as backend: # # auth_backend = airflow.api.auth.backend.basic_auth # # Make sure that your user/name are configured properly # Configure HTTP basic authorization: Basic configuration = airflow_client.client.Configuration( host="http://localhost/api/v1", username='admin', password='admin' ) # Enter a context with an instance of the API client with airflow_client.client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = config_api.ConfigApi(api_client) try: # Get current configuration api_response = api_instance.get_config() pprint(api_response) except airflow_client.client.ApiException as e: print("Exception when calling ConfigApi->get_config: %s\n" % e)
See README for full client API documentation.
The Python client is generated using Airflow's openapi spec. To update the client for new APIs do the following steps:
# clone this repo git clone git@github.com:apache/airflow-client-python.git # clone Airflow repo (if not already) git clone git@github.com:apache/airflow.git cd airflow # bump up the version in python.sh & run the following command ./clients/gen/python.sh airflow/api_connexion/openapi/v1.yaml ../airflow-client-python/airflow_client # raise a PR in github for both the repos (airflow & airflow-client-python)