rosrestpy


Namerosrestpy JSON
Version 0.12.0 PyPI version JSON
download
home_pagehttps://github.com/hexatester/rosrestpy
SummaryRouterOS v7 REST API python module
upload_time2023-10-25 00:57:19
maintainer
docs_urlNone
authorhexatester
requires_python>=3.8,<4.0
licenseGPL-3.0-only
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # RosRestPy

[![PyPi Package Version](https://img.shields.io/pypi/v/rosrestpy)](https://pypi.org/project/rosrestpy/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/rosrestpy)](https://pypi.org/project/rosrestpy/)
[![LICENSE](https://img.shields.io/github/license/hexatester/rosrestpy)](https://github.com/hexatester/rosrestpy/blob/main/LICENSE)

Mikrotik's RouterOS v7 REST API python module

## RouterOS v7 REST API Support

[Check Here for API Support](https://github.com/hexatester/rosrestpy/blob/main/TODO.md).

Not all types and methods of the RouterOS v7 REST API are supported, yet.
Finding any bugs? Please [Create Issue](https://github.com/hexatester/rosrestpy/issues)

## Installing

You can install or upgrade rosrestpy with:

```bash
pip install rosrestpy --upgrade
```

## Example

```python
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)

# 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](https://help.mikrotik.com/docs/display/ROS/REST+API) is the technical reference for `rosrestpy`.

## Contributing

Contributions of all sizes are welcome. Please review our [contribution guidelines](https://github.com/hexatester/rosrestpy/blob/main/CONTRIBUTING.md "How To Contribute") to get started. You can also help by [reporting bugs or feature requests](https://github.com/hexatester/rosrestpy/issues/new/choose).

## Open Source Notice

Big thanks to [attrs](https://www.attrs.org/) and [cattrs](https://catt.rs/) as the bases of rosrestpy, without them this module creation would be very tedious!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hexatester/rosrestpy",
    "name": "rosrestpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "hexatester",
    "author_email": "hexatester@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/de/04/ab3b43523ffff0bfde9c22b60c937f58dcb6c7fb5db327b840582b3e1415/rosrestpy-0.12.0.tar.gz",
    "platform": null,
    "description": "# RosRestPy\n\n[![PyPi Package Version](https://img.shields.io/pypi/v/rosrestpy)](https://pypi.org/project/rosrestpy/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/rosrestpy)](https://pypi.org/project/rosrestpy/)\n[![LICENSE](https://img.shields.io/github/license/hexatester/rosrestpy)](https://github.com/hexatester/rosrestpy/blob/main/LICENSE)\n\nMikrotik's RouterOS v7 REST API python module\n\n## RouterOS v7 REST API Support\n\n[Check Here for API Support](https://github.com/hexatester/rosrestpy/blob/main/TODO.md).\n\nNot all types and methods of the RouterOS v7 REST API are supported, yet.\nFinding any bugs? Please [Create Issue](https://github.com/hexatester/rosrestpy/issues)\n\n## Installing\n\nYou can install or upgrade rosrestpy with:\n\n```bash\npip install rosrestpy --upgrade\n```\n\n## Example\n\n```python\nfrom ros import Ros\n\n# Initiate Ros object\nros = Ros(\"https://192.168.88.1/\", \"admin\", \"\")\n\n\n# Check cpu load\nif ros.system.resource.cpu_load > 90:\n    print(f\"{ros.system.identity}'s CPU > 90%\")\n\n# Print all interface name\nfor interface in ros.interface():\n    print(interface.name)\n\n# Finding specific queue\nqueues = ros.queue.simple(name=\"Hotspot\")\nif len(queues) == 1:\n    queue = queues[0]\n    print(f\"Usage {queue.bytes}\")\n\n# Adding new /simple/queue\nfrom ros.queue import SimpleQueue\nnew_queue = SimpleQueue(name=\"Test\", target=\"192.168.88.0/24\", max_limit=\"10M/10M\", disabled=True)\nnew_queue = ros.queue.simple.add(new_queue)\nprint(new_queue)\n\n# Updating /simple/queue\ntest_queue = ros.queue.simple(name=\"Test\")[0]\nnew_test_queue = ros.queue.simple.set(test_queue, {\"comment\": \"Test comment\"})\nprint(new_test_queue)\n\n# Using /tool/bandwith-test\nbw_tests = ros.tool.bandwith_test(\"172.16.0.1\", \"3s\", \"admin\", direction=\"both\")\nresult_bw_test = bw_tests[-1]\nprint(f\"Download {result_bw_test.rx_total_average}\")\nprint(f\"Upload {result_bw_test.tx_total_average}\")\n```\n\n## Resources\n\nThe [RouterOS REST API](https://help.mikrotik.com/docs/display/ROS/REST+API) is the technical reference for `rosrestpy`.\n\n## Contributing\n\nContributions of all sizes are welcome. Please review our [contribution guidelines](https://github.com/hexatester/rosrestpy/blob/main/CONTRIBUTING.md \"How To Contribute\") to get started. You can also help by [reporting bugs or feature requests](https://github.com/hexatester/rosrestpy/issues/new/choose).\n\n## Open Source Notice\n\nBig thanks to [attrs](https://www.attrs.org/) and [cattrs](https://catt.rs/) as the bases of rosrestpy, without them this module creation would be very tedious!\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-only",
    "summary": "RouterOS v7 REST API python module",
    "version": "0.12.0",
    "project_urls": {
        "Homepage": "https://github.com/hexatester/rosrestpy",
        "Repository": "https://github.com/hexatester/rosrestpy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "676050f7f26e490f33c6a240320cbb06018dd19d09b094598035fa3e34e99576",
                "md5": "34f13bd69ec2b6587a98ee8df8665817",
                "sha256": "84509b2749794e045ed8660c7bae4f357eafc1567952620df2336ad38b5a8ecf"
            },
            "downloads": -1,
            "filename": "rosrestpy-0.12.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "34f13bd69ec2b6587a98ee8df8665817",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 74600,
            "upload_time": "2023-10-25T00:57:17",
            "upload_time_iso_8601": "2023-10-25T00:57:17.194590Z",
            "url": "https://files.pythonhosted.org/packages/67/60/50f7f26e490f33c6a240320cbb06018dd19d09b094598035fa3e34e99576/rosrestpy-0.12.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de04ab3b43523ffff0bfde9c22b60c937f58dcb6c7fb5db327b840582b3e1415",
                "md5": "566146a19759c1741a0ac3229f7013d7",
                "sha256": "0e1d44456fb0be3106b77ca038ea15aaa1570b08a3d93c27f6a4ed8679d5d597"
            },
            "downloads": -1,
            "filename": "rosrestpy-0.12.0.tar.gz",
            "has_sig": false,
            "md5_digest": "566146a19759c1741a0ac3229f7013d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 43375,
            "upload_time": "2023-10-25T00:57:19",
            "upload_time_iso_8601": "2023-10-25T00:57:19.214012Z",
            "url": "https://files.pythonhosted.org/packages/de/04/ab3b43523ffff0bfde9c22b60c937f58dcb6c7fb5db327b840582b3e1415/rosrestpy-0.12.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-25 00:57:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hexatester",
    "github_project": "rosrestpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "rosrestpy"
}
        
Elapsed time: 0.12875s