zepben.eas


Namezepben.eas JSON
Version 0.14.1 PyPI version JSON
download
home_pagehttps://bitbucket.org/zepben/eas-python-client
SummaryPython SDK for interacting with the Evolve App Server
upload_time2024-01-16 01:31:12
maintainer
docs_urlNone
authorRamon Bouckaert
requires_python>=3.9
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Evolve App Server Python Client #

This library provides a wrapper to the Evolve App Server's API, allowing users of the evolve SDK to authenticate with
the Evolve App Server and upload studies.

# Usage #

```python
from geojson import FeatureCollection
from zepben.eas import EasClient, Study, Result, Section, GeoJsonOverlay

eas_client = EasClient(
    host="<host>",
    port=1234,
    client_id="<client_id>",
    username="<username>",
    password="<password>",
    client_secret="<client_secret>"
)

eas_client.upload_study(
    Study(
        name="<study name>",
        description="<study description>",
        tags=["<tag>", "<tag2>"],
        results=[
            Result(
                name="<result_name>",
                geo_json_overlay=GeoJsonOverlay(
                    data=FeatureCollection( ... ),
                    styles=["style1"]
                ),
                sections=Section(
                    type="TABLE",
                    name="<table name>",
                    description = "<table description>",
                    columns=[
                        { "key": "<column 1 key>", "name": "<column 1 name>" },
                        { "key": "<column 2 key>", "name": "<column 2 name>" },
                    ],
                    data=[
                        { "<column 1 key>": "<column 1 row 1 value>", "<column 2 key>": "<column 2 row 1 value>" },
                        { "<column 1 key>": "<column 1 row 2 value>", "<column 2 key>": "<column 2 row 2 value>" }
                    ]
                )
            )
        ],
        styles=[
            {
                "id": "style1",
                # other Mapbox GL JS style properties
            }
        ]
    )
)

eas_client.close()
```

## AsyncIO ##
Asyncio is also supported using aiohttp. A session will be created for you when you create an EasClient if not provided via the `session` parameter to EasClient.

To use the asyncio API use `async_upload_study` like so:

```python
from aiohttp import ClientSession
from geojson import FeatureCollection
from zepben.eas import EasClient, Study, Result, Section, GeoJsonOverlay

async def upload():
    eas_client = EasClient(
        host="<host>",
        port=1234,
        client_id="<client_id>",
        username="<username>",
        password="<password>",
        client_secret="<client_secret>",
        session=ClientSession(...)
    )

    await eas_client.async_upload_study(
        Study(
            name="<study name>",
            description="<study description>",
            tags=["<tag>", "<tag2>"],
            results=[
                Result(
                    name="<result_name>",
                    geo_json_overlay=GeoJsonOverlay(
                        data=FeatureCollection( ... ),
                        styles=["style1"]
                    ),
                    sections=Section(
                        type="TABLE",
                        name="<table name>",
                        description = "<table description>",
                        columns=[
                            { "key": "<column 1 key>", "name": "<column 1 name>" },
                            { "key": "<column 2 key>", "name": "<column 2 name>" },
                        ],
                        data=[
                            { "<column 1 key>": "<column 1 row 1 value>", "<column 2 key>": "<column 2 row 1 value>" },
                            { "<column 1 key>": "<column 1 row 2 value>", "<column 2 key>": "<column 2 row 2 value>" }
                        ]
                    )
                )
            ],
            styles=[
                {
                    "id": "style1",
                    # other Mapbox GL JS style properties
                }
            ]
        )
    )

    await eas_client.aclose()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://bitbucket.org/zepben/eas-python-client",
    "name": "zepben.eas",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "Ramon Bouckaert",
    "author_email": "ramon.bouckaert@zepben.com",
    "download_url": "",
    "platform": null,
    "description": "# Evolve App Server Python Client #\n\nThis library provides a wrapper to the Evolve App Server's API, allowing users of the evolve SDK to authenticate with\nthe Evolve App Server and upload studies.\n\n# Usage #\n\n```python\nfrom geojson import FeatureCollection\nfrom zepben.eas import EasClient, Study, Result, Section, GeoJsonOverlay\n\neas_client = EasClient(\n    host=\"<host>\",\n    port=1234,\n    client_id=\"<client_id>\",\n    username=\"<username>\",\n    password=\"<password>\",\n    client_secret=\"<client_secret>\"\n)\n\neas_client.upload_study(\n    Study(\n        name=\"<study name>\",\n        description=\"<study description>\",\n        tags=[\"<tag>\", \"<tag2>\"],\n        results=[\n            Result(\n                name=\"<result_name>\",\n                geo_json_overlay=GeoJsonOverlay(\n                    data=FeatureCollection( ... ),\n                    styles=[\"style1\"]\n                ),\n                sections=Section(\n                    type=\"TABLE\",\n                    name=\"<table name>\",\n                    description = \"<table description>\",\n                    columns=[\n                        { \"key\": \"<column 1 key>\", \"name\": \"<column 1 name>\" },\n                        { \"key\": \"<column 2 key>\", \"name\": \"<column 2 name>\" },\n                    ],\n                    data=[\n                        { \"<column 1 key>\": \"<column 1 row 1 value>\", \"<column 2 key>\": \"<column 2 row 1 value>\" },\n                        { \"<column 1 key>\": \"<column 1 row 2 value>\", \"<column 2 key>\": \"<column 2 row 2 value>\" }\n                    ]\n                )\n            )\n        ],\n        styles=[\n            {\n                \"id\": \"style1\",\n                # other Mapbox GL JS style properties\n            }\n        ]\n    )\n)\n\neas_client.close()\n```\n\n## AsyncIO ##\nAsyncio is also supported using aiohttp. A session will be created for you when you create an EasClient if not provided via the `session` parameter to EasClient.\n\nTo use the asyncio API use `async_upload_study` like so:\n\n```python\nfrom aiohttp import ClientSession\nfrom geojson import FeatureCollection\nfrom zepben.eas import EasClient, Study, Result, Section, GeoJsonOverlay\n\nasync def upload():\n    eas_client = EasClient(\n        host=\"<host>\",\n        port=1234,\n        client_id=\"<client_id>\",\n        username=\"<username>\",\n        password=\"<password>\",\n        client_secret=\"<client_secret>\",\n        session=ClientSession(...)\n    )\n\n    await eas_client.async_upload_study(\n        Study(\n            name=\"<study name>\",\n            description=\"<study description>\",\n            tags=[\"<tag>\", \"<tag2>\"],\n            results=[\n                Result(\n                    name=\"<result_name>\",\n                    geo_json_overlay=GeoJsonOverlay(\n                        data=FeatureCollection( ... ),\n                        styles=[\"style1\"]\n                    ),\n                    sections=Section(\n                        type=\"TABLE\",\n                        name=\"<table name>\",\n                        description = \"<table description>\",\n                        columns=[\n                            { \"key\": \"<column 1 key>\", \"name\": \"<column 1 name>\" },\n                            { \"key\": \"<column 2 key>\", \"name\": \"<column 2 name>\" },\n                        ],\n                        data=[\n                            { \"<column 1 key>\": \"<column 1 row 1 value>\", \"<column 2 key>\": \"<column 2 row 1 value>\" },\n                            { \"<column 1 key>\": \"<column 1 row 2 value>\", \"<column 2 key>\": \"<column 2 row 2 value>\" }\n                        ]\n                    )\n                )\n            ],\n            styles=[\n                {\n                    \"id\": \"style1\",\n                    # other Mapbox GL JS style properties\n                }\n            ]\n        )\n    )\n\n    await eas_client.aclose()\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python SDK for interacting with the Evolve App Server",
    "version": "0.14.1",
    "project_urls": {
        "Homepage": "https://bitbucket.org/zepben/eas-python-client"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6db726558d6f3cef5480822cac264ab0afa818b7982b1c3a28d61c12dfe5440d",
                "md5": "934c6376b9f0c3ef8899e943fb894b6d",
                "sha256": "d36c0391a40f8d55069f0055e6331e32e589a7809f9d76c54518624b146908ab"
            },
            "downloads": -1,
            "filename": "zepben.eas-0.14.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "934c6376b9f0c3ef8899e943fb894b6d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 17821,
            "upload_time": "2024-01-16T01:31:12",
            "upload_time_iso_8601": "2024-01-16T01:31:12.328806Z",
            "url": "https://files.pythonhosted.org/packages/6d/b7/26558d6f3cef5480822cac264ab0afa818b7982b1c3a28d61c12dfe5440d/zepben.eas-0.14.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-16 01:31:12",
    "github": false,
    "gitlab": false,
    "bitbucket": true,
    "codeberg": false,
    "bitbucket_user": "zepben",
    "bitbucket_project": "eas-python-client",
    "lcname": "zepben.eas"
}
        
Elapsed time: 0.17130s