rosrestpy


Namerosrestpy JSON
Version 0.12.2 PyPI version JSON
download
home_pagehttps://github.com/hexatester/rosrestpy
SummaryRouterOS v7 REST API python module
upload_time2024-07-10 14:51:54
maintainerNone
docs_urlNone
authorhexatester
requires_python<4.0,>=3.8
licenseGPL-3.0-only
keywords
VCS
bugtrack_url
requirements attrs cattrs certifi charset-normalizer exceptiongroup idna requests urllib3
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)

# 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](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": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "hexatester",
    "author_email": "hexatester@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f7/56/8ff4070105c76da6b95590a0db9cebfcf37e3a450cf2aebc50956be25c6a/rosrestpy-0.12.2.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# Deleting /simple/queue\ntest_queue = ros.queue.simple(name=\"Test\")[0]\nros.queue.simple.delete(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.2",
    "project_urls": {
        "Homepage": "https://github.com/hexatester/rosrestpy",
        "Repository": "https://github.com/hexatester/rosrestpy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9448e66f6b016deafde5222aba0cc371b136ef33a9045129e32b68acff2ce361",
                "md5": "43eaa5a0efb2b0b693b9adda106f9711",
                "sha256": "7f5cb57e6df9692c18058064c9c4fda19ca54fe450e800180735e50fa3159ad2"
            },
            "downloads": -1,
            "filename": "rosrestpy-0.12.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "43eaa5a0efb2b0b693b9adda106f9711",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 74915,
            "upload_time": "2024-07-10T14:51:52",
            "upload_time_iso_8601": "2024-07-10T14:51:52.938120Z",
            "url": "https://files.pythonhosted.org/packages/94/48/e66f6b016deafde5222aba0cc371b136ef33a9045129e32b68acff2ce361/rosrestpy-0.12.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f7568ff4070105c76da6b95590a0db9cebfcf37e3a450cf2aebc50956be25c6a",
                "md5": "c34b62e76bba67fa8d35ff2716eed760",
                "sha256": "907f4874873d03e23303aa143f19feeb8b96ff8a3e8ca358794d53691cef4714"
            },
            "downloads": -1,
            "filename": "rosrestpy-0.12.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c34b62e76bba67fa8d35ff2716eed760",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 43628,
            "upload_time": "2024-07-10T14:51:54",
            "upload_time_iso_8601": "2024-07-10T14:51:54.714350Z",
            "url": "https://files.pythonhosted.org/packages/f7/56/8ff4070105c76da6b95590a0db9cebfcf37e3a450cf2aebc50956be25c6a/rosrestpy-0.12.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-10 14:51:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hexatester",
    "github_project": "rosrestpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "attrs",
            "specs": [
                [
                    "==",
                    "22.2.0"
                ]
            ]
        },
        {
            "name": "cattrs",
            "specs": [
                [
                    "==",
                    "22.2.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2024.7.4"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.2"
                ]
            ]
        },
        {
            "name": "exceptiongroup",
            "specs": [
                [
                    "==",
                    "1.2.1"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.7"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.2.2"
                ]
            ]
        }
    ],
    "lcname": "rosrestpy"
}
        
Elapsed time: 0.28602s