1

Passing arguments to python-wialon API functions

Тема: Passing arguments to python-wialon API functions

Hi. I've installed the python wrapper to interact with Wialon Remote API and wanted to ask a very basic problem.

Following the steps of usage of this library I succeeded in retrieving events (avl_events()), but I don't know how to pass the arguments for the other functions of the Remote API  (For example, wialon_api.request needs 4 arguments such a self, action, url and params)
Could someone explain that to me?

Thanks in advance for your time and help, and sorry for the newbie question.

Germán

2

Passing arguments to python-wialon API functions

(28/10/2016 17:26:13 отредактировано spev)

Re: Passing arguments to python-wialon API functions

from wialon.api import Wialon, WialonError
from wialon import flags

try:
    wialon_api = Wialon()
    result = wialon_api.token_login(token='YOUR_TOKEN')
    wialon_api.sid = result['eid']

    result = wialon_api.avl_evts()

    print result

    spec = {
        'itemsType': 'avl_unit',
        'propName': 'sys_name',
        'propValueMask': '*',
        'sortType': 'sys_name'
    }

    interval = {"from": 0, "to": 0}

    try:
        units = wialon_api.core_search_items(spec=spec, force=1, flags=flags.ITEM_DATAFLAG_BASE, **interval)
        print units
    except WialonError as e:
        print e


    wialon_api.core_logout()
except WialonError as e:
    pass

Method name - core_search_items (is "svc" core/search_items in Remote API  Just replace "/" with "_" and use like method name. )

Telegram: Обновления Wialon, Wialon updates
Google Chrome Extensions: Wialon Units Map | Gurtam Forum Notifications | Wialon Apps Launcher
Evgenij Spitsyn, Developer, flespi team