airflow_client.client.DagSourceApi

All URIs are relative to http://localhost

MethodHTTP requestDescription
get_dag_sourceGET /api/v2/dagSources/{dag_id}Get Dag Source

get_dag_source

DAGSourceResponse get_dag_source(dag_id, version_number=version_number, accept=accept)

Get Dag Source

Get source code using file token.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
import airflow_client.client
from airflow_client.client.models.dag_source_response import DAGSourceResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_client.client.Configuration(
    host = "http://localhost"
)

# The client must configure 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# 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 = airflow_client.client.DagSourceApi(api_client)
    dag_id = 'dag_id_example' # str | 
    version_number = 56 # int |  (optional)
    accept = */* # str |  (optional) (default to */*)

    try:
        # Get Dag Source
        api_response = api_instance.get_dag_source(dag_id, version_number=version_number, accept=accept)
        print("The response of DagSourceApi->get_dag_source:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling DagSourceApi->get_dag_source: %s\n" % e)

Parameters

NameTypeDescriptionNotes
dag_idstr
version_numberint[optional]
acceptstr[optional] [default to /]

Return type

DAGSourceResponse

Authorization

OAuth2PasswordBearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200Successful Response-
400Bad Request-
401Unauthorized-
403Forbidden-
404Not Found-
406Not Acceptable-
422Validation Error-

[Back to top] [Back to API list] [Back to Model list] [Back to README]