Skip to main content

ARA

Version License Python Status Format Wheel Build Coverage Downloads


AIRFLOW-REST-API

Async wrapper for Airflow REST API. See more in documentation

INSTALL

pip install airflow-rest-api

USAGE

import asyncio
import os
import aiohttp
from airflow_rest_api.api import AirflowRestApi

AIRFLOW_HOST = os.environ.get("AIRFLOW_HOST", "http://127.0.0.1:8080")
AIRFLOW_USER = os.environ.get("AIRFLOW_USER", "admin")
AIRFLOW_PASSWORD = os.environ.get("AIRFLOW_PASSWORD", "admin")


async def main(ara):
    for template in ara.find_template("/dags"):
        template_id = template.id
        break
    auth = aiohttp.BasicAuth(AIRFLOW_USER, AIRFLOW_PASSWORD)
    async with aiohttp.ClientSession(auth=auth) as session:
        airflow_tasks = await ara.execute(session=session, template_id=template_id)
        if airflow_tasks.status == 200:
            file_token = airflow_tasks.raw["dags"][0]["file_token"]
            template_id = 360
            dag_source_code = (
                await ara.execute(
                    session=session,
                    method=ara.get_template(template_id).method,
                    url=ara.render_url(template_id=template_id, file_token=file_token)
                    )
                ).raw
            print(dag_source_code)


ara = AirflowRestApi(airflow_host=AIRFLOW_HOST)
ara.show_templates()

loop = asyncio.get_event_loop()
loop.run_until_complete(main(ara))

Metadata

Release files for airflow-rest-api 0.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airflow-rest-api 0.0.0
File Size Uploaded
airflow-rest-api-0.0.0.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for airflow-rest-api 0.0.0
File Interpreter ABI Platform
airflow_rest_api-0.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.7 kB

Release files / airflow-rest-api-0.0.0.tar.gz

Download URL airflow-rest-api-0.0.0.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a940b070f8e9277addcf62e96d0ef8a75a29c214724f8e0f3561f64c0712aab5
BLAKE2b-256 checksum
How to use checksums
451c120593776bc686fc61da5557a65bd07983b6a38cc6323fef9711551c346d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / airflow_rest_api-0.0.0-py3-none-any.whl

Download URL airflow_rest_api-0.0.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6d9acc559de49afded860c52bc1dfd90d30a3510ff69c2c7f6d6cb1c24195f2
BLAKE2b-256 checksum
How to use checksums
983278ba6b4ebb070569a0e7f99a5f9cb99044707e085749a0dbccdeb4ab13ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page