GitXplorerGitXplorer
h

rosrestpy

public
27 stars
6 forks
4 issues

Commits

List of commits on branch main.
Unverified
8bfebec2659cc8140948768c81cee6bc0efa7545

add .delete_as

hhexatester committed 6 months ago
Unverified
e9a0ed5cfe86aeb05088dc9de396a5f79198be7c

Bumping version from 0.12.1 to 0.12.2

hhexatester committed 6 months ago
Unverified
dfd2c5d99019e473335055178555bae4799ca723

add missing fields as per ros v7.15.1

hhexatester committed 6 months ago
Unverified
69d5b42213d88d7d7d0dc1bc00c9851d24b89edb

debug on test

hhexatester committed 6 months ago
Unverified
43a1e18f3e7d07168ae54f65b2ad04eb7e85dba3

add check_props for missing type

hhexatester committed 6 months ago
Unverified
ed820740646ec942027861cee2f135f184027875

add Deleting

hhexatester committed 6 months ago

README

The README file for this repository.

RosRestPy

PyPi Package Version Supported Python versions LICENSE

Mikrotik's RouterOS v7 REST API python module

RouterOS v7 REST API Support

Check Here for API Support.

Not all types and methods of the RouterOS v7 REST API are supported, yet. Finding any bugs? Please Create Issue

Installing

You can install or upgrade rosrestpy with:

pip install rosrestpy --upgrade

Example

from ros import Ros

# Initiate Ros object
ros = Ros("https://192.168.88.1/", "admin", "")


# Check cpu load
if ros.system.resource.cpu_load > 90:
    print(f"{ros.system.identity}'s CPU > 90%")

# Print all interface name
for interface in ros.interface():
    print(interface.name)

# Finding specific queue
queues = ros.queue.simple(name="Hotspot")
if len(queues) == 1:
    queue = queues[0]
    print(f"Usage {queue.bytes}")

# Adding new /simple/queue
from ros.queue import SimpleQueue
new_queue = SimpleQueue(name="Test", target="192.168.88.0/24", max_limit="10M/10M", disabled=True)
new_queue = ros.queue.simple.add(new_queue)
print(new_queue)

# Updating /simple/queue
test_queue = ros.queue.simple(name="Test")[0]
new_test_queue = ros.queue.simple.set(test_queue, {"comment": "Test comment"})
print(new_test_queue)

# Deleting /simple/queue
test_queue = ros.queue.simple(name="Test")[0]
ros.queue.simple.delete(test_queue)

# Using /tool/bandwith-test
bw_tests = ros.tool.bandwith_test("172.16.0.1", "3s", "admin", direction="both")
result_bw_test = bw_tests[-1]
print(f"Download {result_bw_test.rx_total_average}")
print(f"Upload {result_bw_test.tx_total_average}")

Resources

The RouterOS REST API is the technical reference for rosrestpy.

Contributing

Contributions of all sizes are welcome. Please review our contribution guidelines to get started. You can also help by reporting bugs or feature requests.

Open Source Notice

Big thanks to attrs and cattrs as the bases of rosrestpy, without them this module creation would be very tedious!