kaxil commented on code in PR #63017:
URL: https://github.com/apache/airflow/pull/63017#discussion_r2897954714


##########
airflow-ctl/docs/howto/index.rst:
##########
@@ -114,6 +114,35 @@ This parameter is useful when you want to manage multiple 
Airflow environments.
 Useful when there's no keyring available in the system where airflowctl is 
running.
 Set ``AIRFLOW_CLI_TOKEN`` or use the ``--api-token`` flag for next commands.
 
+
+Use Airflow Ctl (airflowctl) as SDK
+'''''''''''''''''''''''''''''''''''
+airflowctl can also be used as a Python SDK to interact with the Airflow API 
programmatically.
+You can import the necessary modules and use the functions provided by 
airflowctl to perform various operations on the Airflow API.
+
+
+.. code-block:: python
+
+  import httpx
+  from airflow_ctl.api.client import Client, Credentials, ServerResponseError
+  from airflowctl.api.datamodels.generated import DAGPatchBody
+
+  # Reusable API Client until token expires
+  api_client = Client(
+      base_url="AIRFLOW_API_URL",
+      limits=httpx.Limits(max_keepalive_connections=1, max_connections=1),
+      token="TOKEN",
+  )
+
+  # Example: Pausing a DAG
+  dag_id = "EXAMPLE_DAG_ID"
+  try:
+      api_client.dags.update(dag_id=dag_id, 
dag_body=DAGPatchBody(is_paused="pause"))
+  except ServerResponseError as e:
+      # Handle error
+      pass

Review Comment:
   Why do you want to open that can of worms :D -- then you will need to keep 
this interface too!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to