Esempio n. 1
0
from formant.sdk.cloud.v1 import Client as FormantClient

if __name__ == "__main__":
    # to authenticate set FORMANT_EMAIL and FORMANT_PASSWORD
    # environment variables for an existing service account
    fclient = FormantClient()

    device_id = "572f5ff3-63e9-4687-b242-c0d8a4891d80"

    # query by tags
    query_result = fclient.query({
        "start": "2021-01-01T00:00:00.000Z",
        "end": "2021-01-10T00:00:00.000Z",
        "tags": {
            "location": ["sf"]
        },
    })

    # query by device
    query_result = fclient.query({
        "start": "2021-01-01T00:00:00.000Z",
        "end": "2021-01-10T00:00:00.000Z",
        "deviceIds": [device_id],
    })
    print(query_result)
Esempio n. 2
0
            names: ["engine_temp"],
            types: ["numeric"],
            tags: {"location":["sf","la"]},
            notNames: ["speed"],
        }
    """

    fclient = FormantClient()

    device_id = "572f5ff3-63e9-4687-b242-c0d8a4891d80"

    # query by tags
    tag_query_result = fclient.query({
        "start": "2021-01-01T00:00:00.000Z",
        "end": "2021-01-10T00:00:00.000Z",
        "tags": {
            "location": ["sf"]
        },
    })
    print(tag_query_result)

    # query by device
    device_query_result = fclient.query({
        "start": "2021-01-01T00:00:00.000Z",
        "end": "2021-01-10T00:00:00.000Z",
        "deviceIds": [device_id],
    })
    print(device_query_result)

    # query by filetype
    file_query_result = fclient.query({