airflow-rest-api


Nameairflow-rest-api JSON
Version 0.0.0 PyPI version JSON
download
home_pagehttps://bit.ly/ara-bb
SummaryAsync wrapper for Airflow REST API
upload_time2023-06-25 13:14:18
maintainerMichael R. Kisel <deploy-me@yandex.ru>
docs_urlNone
authorMichael R. Kisel
requires_python<4,>=3.7
licenseMIT
keywords airflow airflow rest api async airflow async rest api async api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <a href="https://bit.ly/airflow-ra"><img src="https://bit.ly/ara-logo" alt="ARA"></a>
</p>
<p align="center">
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://img.shields.io/pypi/v/airflow-rest-api.svg?style=flat-square&logo=appveyor" alt="Version"></a>
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://img.shields.io/pypi/l/airflow-rest-api.svg?style=flat-square&logo=appveyor&color=blueviolet" alt="License"></a>
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://img.shields.io/pypi/pyversions/airflow-rest-api.svg?style=flat-square&logo=appveyor" alt="Python"></a>
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://img.shields.io/pypi/status/airflow-rest-api.svg?style=flat-square&logo=appveyor" alt="Status"></a>
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://img.shields.io/pypi/format/airflow-rest-api.svg?style=flat-square&logo=appveyor&color=yellow" alt="Format"></a>
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://img.shields.io/pypi/wheel/airflow-rest-api.svg?style=flat-square&logo=appveyor&color=red" alt="Wheel"></a>
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://img.shields.io/bitbucket/pipelines/deploy-me/airflow-rest-api/master?style=flat-square&logo=appveyor" alt="Build"></a>
    <a href="https://pypi.org/project/airflow-rest-api"><img src="https://bit.ly/ara-cov" alt="Coverage"></a>
    <a href="https://pepy.tech/project/airflow-rest-api"><img src="https://static.pepy.tech/personalized-badge/airflow-rest-api?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads" alt="Downloads"></a>
    <br><br><br>
</p>

# AIRFLOW-REST-API

Async wrapper for [Airflow REST API](https://bit.ly/ara-docs). See more in [documentation](https://deploy-me.bitbucket.io/airflow-rest-api/index.html)

## INSTALL

```bash
pip install airflow-rest-api
```

## USAGE

```python
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))
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://bit.ly/ara-bb",
    "name": "airflow-rest-api",
    "maintainer": "Michael R. Kisel <deploy-me@yandex.ru>",
    "docs_url": null,
    "requires_python": "<4,>=3.7",
    "maintainer_email": "deploy-me@yandex.ru",
    "keywords": "airflow,airflow rest api,async airflow,async rest api,async api",
    "author": "Michael R. Kisel",
    "author_email": "deploy-me@yandex.ru",
    "download_url": "https://files.pythonhosted.org/packages/45/1c/120593776bc686fc61da5557a65bd07983b6a38cc6323fef9711551c346d/airflow-rest-api-0.0.0.tar.gz",
    "platform": "any",
    "description": "<p align=\"center\">\r\n    <a href=\"https://bit.ly/airflow-ra\"><img src=\"https://bit.ly/ara-logo\" alt=\"ARA\"></a>\r\n</p>\r\n<p align=\"center\">\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://img.shields.io/pypi/v/airflow-rest-api.svg?style=flat-square&logo=appveyor\" alt=\"Version\"></a>\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://img.shields.io/pypi/l/airflow-rest-api.svg?style=flat-square&logo=appveyor&color=blueviolet\" alt=\"License\"></a>\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://img.shields.io/pypi/pyversions/airflow-rest-api.svg?style=flat-square&logo=appveyor\" alt=\"Python\"></a>\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://img.shields.io/pypi/status/airflow-rest-api.svg?style=flat-square&logo=appveyor\" alt=\"Status\"></a>\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://img.shields.io/pypi/format/airflow-rest-api.svg?style=flat-square&logo=appveyor&color=yellow\" alt=\"Format\"></a>\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://img.shields.io/pypi/wheel/airflow-rest-api.svg?style=flat-square&logo=appveyor&color=red\" alt=\"Wheel\"></a>\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://img.shields.io/bitbucket/pipelines/deploy-me/airflow-rest-api/master?style=flat-square&logo=appveyor\" alt=\"Build\"></a>\r\n    <a href=\"https://pypi.org/project/airflow-rest-api\"><img src=\"https://bit.ly/ara-cov\" alt=\"Coverage\"></a>\r\n    <a href=\"https://pepy.tech/project/airflow-rest-api\"><img src=\"https://static.pepy.tech/personalized-badge/airflow-rest-api?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads\" alt=\"Downloads\"></a>\r\n    <br><br><br>\r\n</p>\r\n\r\n# AIRFLOW-REST-API\r\n\r\nAsync wrapper for [Airflow REST API](https://bit.ly/ara-docs). See more in [documentation](https://deploy-me.bitbucket.io/airflow-rest-api/index.html)\r\n\r\n## INSTALL\r\n\r\n```bash\r\npip install airflow-rest-api\r\n```\r\n\r\n## USAGE\r\n\r\n```python\r\nimport asyncio\r\nimport os\r\nimport aiohttp\r\nfrom airflow_rest_api.api import AirflowRestApi\r\n\r\nAIRFLOW_HOST = os.environ.get(\"AIRFLOW_HOST\", \"http://127.0.0.1:8080\")\r\nAIRFLOW_USER = os.environ.get(\"AIRFLOW_USER\", \"admin\")\r\nAIRFLOW_PASSWORD = os.environ.get(\"AIRFLOW_PASSWORD\", \"admin\")\r\n\r\n\r\nasync def main(ara):\r\n    for template in ara.find_template(\"/dags\"):\r\n        template_id = template.id\r\n        break\r\n    auth = aiohttp.BasicAuth(AIRFLOW_USER, AIRFLOW_PASSWORD)\r\n    async with aiohttp.ClientSession(auth=auth) as session:\r\n        airflow_tasks = await ara.execute(session=session, template_id=template_id)\r\n        if airflow_tasks.status == 200:\r\n            file_token = airflow_tasks.raw[\"dags\"][0][\"file_token\"]\r\n            template_id = 360\r\n            dag_source_code = (\r\n                await ara.execute(\r\n                    session=session,\r\n                    method=ara.get_template(template_id).method,\r\n                    url=ara.render_url(template_id=template_id, file_token=file_token)\r\n                    )\r\n                ).raw\r\n            print(dag_source_code)\r\n\r\n\r\nara = AirflowRestApi(airflow_host=AIRFLOW_HOST)\r\nara.show_templates()\r\n\r\nloop = asyncio.get_event_loop()\r\nloop.run_until_complete(main(ara))\r\n```\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Async wrapper for Airflow REST API",
    "version": "0.0.0",
    "project_urls": {
        "Download": "https://bit.ly/ara-dwnld",
        "Homepage": "https://bit.ly/ara-bb"
    },
    "split_keywords": [
        "airflow",
        "airflow rest api",
        "async airflow",
        "async rest api",
        "async api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "983278ba6b4ebb070569a0e7f99a5f9cb99044707e085749a0dbccdeb4ab13ef",
                "md5": "345ec4e78dc1323fa68bf6393f0d2ddc",
                "sha256": "a6d9acc559de49afded860c52bc1dfd90d30a3510ff69c2c7f6d6cb1c24195f2"
            },
            "downloads": -1,
            "filename": "airflow_rest_api-0.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "345ec4e78dc1323fa68bf6393f0d2ddc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.7",
            "size": 13070,
            "upload_time": "2023-06-25T13:14:16",
            "upload_time_iso_8601": "2023-06-25T13:14:16.157796Z",
            "url": "https://files.pythonhosted.org/packages/98/32/78ba6b4ebb070569a0e7f99a5f9cb99044707e085749a0dbccdeb4ab13ef/airflow_rest_api-0.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "451c120593776bc686fc61da5557a65bd07983b6a38cc6323fef9711551c346d",
                "md5": "f33b3bd34a6701d56fab1f21180d0c5f",
                "sha256": "a940b070f8e9277addcf62e96d0ef8a75a29c214724f8e0f3561f64c0712aab5"
            },
            "downloads": -1,
            "filename": "airflow-rest-api-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f33b3bd34a6701d56fab1f21180d0c5f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.7",
            "size": 9658,
            "upload_time": "2023-06-25T13:14:18",
            "upload_time_iso_8601": "2023-06-25T13:14:18.132805Z",
            "url": "https://files.pythonhosted.org/packages/45/1c/120593776bc686fc61da5557a65bd07983b6a38cc6323fef9711551c346d/airflow-rest-api-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-25 13:14:18",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "airflow-rest-api"
}
        
Elapsed time: 0.07935s