py-aiowialon


Namepy-aiowialon JSON
Version 1.2.5 PyPI version JSON
download
home_page
SummaryAsync Wialon Remote API wrapper for Python 3
upload_time2024-03-05 09:21:00
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2013-2016 Gurtam Alex Chernetsky Copyright (c) 2022 Dmytro Yaroshenko (https://github.com/o-murphy) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords async wialon wialon remote api gurtam
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            AIO Wialon
=========

`AIO Wialon` is an async realisation of Python wrapper for Remote Api, 
forked from https://github.com/wialon/python-wialon. (Now with support for Python 3 since v1.0.2)

Installation
------------
    pip install aiohttp
    pip install py-aiowialon

Usage
-----
Create session object with `wialon_session = Wialon(host='TEST HOST', token='TEST TOKEN')`

Setup `@wialon_session.event_handler` for catch `avl_evts` while poling

Use `Wialon.session_did_open` method to set callback on a session did open,
it can be used to make requests (`core_update_data_flags`, for example) 
after `token_login` before `avl_evts` poling loop starts

Start poling with `wialon_session.start_poling()` function 
or `wialon_session.poling()` if you're want to run poling as a coroutine


```python
import asyncio
from aiowialon import Wialon, WialonEvents, WialonEvent, flags


def run():
    """
    Poling example
    """

    wialon_session = Wialon(host='TEST HOST', token='TEST TOKEN')

    async def session_did_open():
        spec = {
            'itemsType': 'avl_unit',
            'propName': 'sys_name',
            'propValueMask': '*',
            'sortType': 'sys_name'
        }
        interval = {"from": 0, "to": 100}
        units = await wialon_session.core_search_items(spec=spec, force=1, flags=5, **interval)
        if 'items' in units:
            ids = [u['id'] for u in units['items']]

            spec = [
                {
                    "type": "col",
                    "data": ids,
                    "flags": flags.ITEM_DATAFLAG_BASE + flags.ITEM_UNIT_DATAFLAG_POS,
                    "mode": 0
                }
            ]
            await wialon_session.core_update_data_flags(spec=spec)

    @wialon_session.event_handler
    async def event_handler(events: WialonEvents):
        if 116106 in events.data:
            item_event: WialonEvent = events.data[116106]
            print(item_event.item, item_event.e_type, item_event.desc)

    @wialon_session.event_handler
    async def event_handler(events: WialonEvents):
        spec = {
            'itemsType': 'avl_unit',
            'propName': 'sys_name',
            'propValueMask': '*',
            'sortType': 'sys_name'
        }
        interval = {"from": 0, "to": 0}
        units = await wialon_session.core_search_items(spec=spec, force=1, flags=5, **interval)
        print(events.__dict__, units['totalItemsCount'])

    wialon_session.session_did_open(callback=session_did_open)
    wialon_session.start_poling()

run()

```

API Documentation
-----------------

[Wialon Remote Api documentation](http://sdk.wialon.com/wiki/en/sidebar/remoteapi/apiref/apiref "Remote Api")

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "py-aiowialon",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "async,wialon,wialon remote api,gurtam",
    "author": "",
    "author_email": "o-murphy <thehelixpg@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/71/46/0b0a854c800851b3794c45cf5a98aa64c13356bf0c4d648af996de43d9b8/py-aiowialon-1.2.5.tar.gz",
    "platform": null,
    "description": "AIO Wialon\n=========\n\n`AIO Wialon` is an async realisation of Python wrapper for Remote Api, \nforked from https://github.com/wialon/python-wialon. (Now with support for Python 3 since v1.0.2)\n\nInstallation\n------------\n    pip install aiohttp\n    pip install py-aiowialon\n\nUsage\n-----\nCreate session object with `wialon_session = Wialon(host='TEST HOST', token='TEST TOKEN')`\n\nSetup `@wialon_session.event_handler` for catch `avl_evts` while poling\n\nUse `Wialon.session_did_open` method to set callback on a session did open,\nit can be used to make requests (`core_update_data_flags`, for example) \nafter `token_login` before `avl_evts` poling loop starts\n\nStart poling with `wialon_session.start_poling()` function \nor `wialon_session.poling()` if you're want to run poling as a coroutine\n\n\n```python\nimport asyncio\nfrom aiowialon import Wialon, WialonEvents, WialonEvent, flags\n\n\ndef run():\n    \"\"\"\n    Poling example\n    \"\"\"\n\n    wialon_session = Wialon(host='TEST HOST', token='TEST TOKEN')\n\n    async def session_did_open():\n        spec = {\n            'itemsType': 'avl_unit',\n            'propName': 'sys_name',\n            'propValueMask': '*',\n            'sortType': 'sys_name'\n        }\n        interval = {\"from\": 0, \"to\": 100}\n        units = await wialon_session.core_search_items(spec=spec, force=1, flags=5, **interval)\n        if 'items' in units:\n            ids = [u['id'] for u in units['items']]\n\n            spec = [\n                {\n                    \"type\": \"col\",\n                    \"data\": ids,\n                    \"flags\": flags.ITEM_DATAFLAG_BASE + flags.ITEM_UNIT_DATAFLAG_POS,\n                    \"mode\": 0\n                }\n            ]\n            await wialon_session.core_update_data_flags(spec=spec)\n\n    @wialon_session.event_handler\n    async def event_handler(events: WialonEvents):\n        if 116106 in events.data:\n            item_event: WialonEvent = events.data[116106]\n            print(item_event.item, item_event.e_type, item_event.desc)\n\n    @wialon_session.event_handler\n    async def event_handler(events: WialonEvents):\n        spec = {\n            'itemsType': 'avl_unit',\n            'propName': 'sys_name',\n            'propValueMask': '*',\n            'sortType': 'sys_name'\n        }\n        interval = {\"from\": 0, \"to\": 0}\n        units = await wialon_session.core_search_items(spec=spec, force=1, flags=5, **interval)\n        print(events.__dict__, units['totalItemsCount'])\n\n    wialon_session.session_did_open(callback=session_did_open)\n    wialon_session.start_poling()\n\nrun()\n\n```\n\nAPI Documentation\n-----------------\n\n[Wialon Remote Api documentation](http://sdk.wialon.com/wiki/en/sidebar/remoteapi/apiref/apiref \"Remote Api\")\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2013-2016 Gurtam Alex Chernetsky Copyright (c) 2022 Dmytro Yaroshenko (https://github.com/o-murphy)  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Async Wialon Remote API wrapper for Python 3",
    "version": "1.2.5",
    "project_urls": {
        "Bug Reports": "https://github.com/o-murphy/py-aiowialon/issues",
        "Homepage": "https://github.com/o-murphy/py-aiowialon",
        "Source": "https://github.com/o-murphy/py-aiowialon"
    },
    "split_keywords": [
        "async",
        "wialon",
        "wialon remote api",
        "gurtam"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92f52415196d2bd202bc9013aaea72b0baab046da802a75c6e268b91641715df",
                "md5": "cfc4819834aa88a38584f1082da84e8e",
                "sha256": "f245377e54399b2ca7433ac8c2399af4fcb506b71038c32fc6eccf771447f415"
            },
            "downloads": -1,
            "filename": "py_aiowialon-1.2.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cfc4819834aa88a38584f1082da84e8e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9253,
            "upload_time": "2024-03-05T09:20:58",
            "upload_time_iso_8601": "2024-03-05T09:20:58.794269Z",
            "url": "https://files.pythonhosted.org/packages/92/f5/2415196d2bd202bc9013aaea72b0baab046da802a75c6e268b91641715df/py_aiowialon-1.2.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "71460b0a854c800851b3794c45cf5a98aa64c13356bf0c4d648af996de43d9b8",
                "md5": "bf0c5f25b9abc71324d60956b4244dc3",
                "sha256": "55d6f59e944787d4891eb0b629b65667992120f7dc8b9b813b14eb4d72eb18a9"
            },
            "downloads": -1,
            "filename": "py-aiowialon-1.2.5.tar.gz",
            "has_sig": false,
            "md5_digest": "bf0c5f25b9abc71324d60956b4244dc3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8963,
            "upload_time": "2024-03-05T09:21:00",
            "upload_time_iso_8601": "2024-03-05T09:21:00.901430Z",
            "url": "https://files.pythonhosted.org/packages/71/46/0b0a854c800851b3794c45cf5a98aa64c13356bf0c4d648af996de43d9b8/py-aiowialon-1.2.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-05 09:21:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "o-murphy",
    "github_project": "py-aiowialon",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "py-aiowialon"
}
        
Elapsed time: 0.19978s