Skip to content

frostspb/aio_api_ros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aio_api_ros

Join the chat at https://gitter.im/aio_api_ros/community PyPI version Downloads star this repo fork this repo

async implementation Mikrotik api

Installation

pip install aio_api_ros

Example of usage

Single connection

import asyncio
from aio_api_ros import create_rosapi_connection

async def main():

    mk = await create_rosapi_connection(
        mk_ip='127.0.0.1',
        mk_port=8728,
        mk_user='myuser',
        mk_psw='mypassword'
    )

    mk.talk_word('/ip/hotspot/active/print')
    res = await mk.read()
    print(res)
    mk.close()


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.close()

Simple connections pool

import asyncio
from aio_api_ros import create_rosapi_simple_pool

async def main():

    mk = await create_rosapi_simple_pool(
        mk_ip='127.0.0.1',
        mk_port=8728,
        mk_user='myuser',
        mk_psw='mypassword',
        max_size=4
    )

    await mk.talk_word('/ip/hotspot/active/print')
    res = await mk.read()
    print(res)
    mk.close()


if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    loop.close()

Releases

No releases published

Packages

No packages published

Languages