Skip to main content

Python SDK for interacting with the Evolve App Server

Project description

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

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

eas_client = EasClient(
    host="<host>",
    port=1234,
    access_token="<access_token>",
    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:

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,
        access_token="<access_token>",
        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()

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zepben_eas-0.27.0.tar.gz (39.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zepben_eas-0.27.0-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file zepben_eas-0.27.0.tar.gz.

File metadata

  • Download URL: zepben_eas-0.27.0.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for zepben_eas-0.27.0.tar.gz
Algorithm Hash digest
SHA256 752871650947f923ec51b32602264c6df228fb9b5014795777315e6092e58112
MD5 35f079011170fd785babe9b325ebcb09
BLAKE2b-256 d829d6b0895ae046b314417e245f9afa39f84fd388394b69e545aa22ba349c2b

See more details on using hashes here.

File details

Details for the file zepben_eas-0.27.0-py3-none-any.whl.

File metadata

  • Download URL: zepben_eas-0.27.0-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for zepben_eas-0.27.0-py3-none-any.whl
Algorithm Hash digest
SHA256 035cf005fb3a00017550937c782893506bfcbfe54bc769b30348dae1568d47ee
MD5 c9f2a3409b8393c1f5167b45266ec268
BLAKE2b-256 91101c1bec74c1a3c5ddff03b12fe5fb4e5ee2ac869bfebab60773e4cc13245a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page