Registry / http-networking / librouteros

librouteros

JSON →
library4.1.1pypypi✓ verified 91d ago

Pure Python implementation of the MikroTik RouterOS API for managing RouterOS devices. Version 4.0.1, requires Python >=3.9. Release cadence is irregular.

pip install librouteros
INSTALL
IMPORT
SIG · LIBROUTEROS
L
librouteros
http-networkingpythonv4.1.1
Install
1.7s avg
Import
206ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v4.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.218s · 17.9MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.7s · import 0.194s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

connect
✓ from librouteros import connect
✗ from librouteros.api import connect
connect() was previously under api submodule, now at top level.
Login
✓ from librouteros import connect
✗ from librouteros.login import Login
Login class was removed; use connect() with username/password.

Connect to a MikroTik RouterOS device and fetch system identity.

from librouteros import connect api = connect( host=os.environ.get('ROUTEROS_HOST', ''), username=os.environ.get('ROUTEROS_USER', 'admin'), password=os.environ.get('ROUTEROS_PASS', ''), ) print(api.get_resource('/system/identity').get())
Debug
Known issues
breakingIn version 4.0.0, the connect() function moved from librouteros.api to librouteros (top-level). Old imports will break.
fix
Use `from librouteros import connect` instead of `from librouteros.api import connect`.
affects: >=4.0.0
breakingThe Login class and related exceptions (LoginError) were removed. Use connect() which returns a connection object directly.
fix
Replace `api = Login(host, user, pass).get_instance()` with `api = connect(host=host, username=user, password=pass)`.
affects: >=4.0.0
gotchaResource paths (e.g., '/system/identity') must start with a slash. Omitting the slash returns empty results without error.
fix
Always prefix resource paths with '/'.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'librouteros.api'
In version 4.0.0, the API submodule was reorganized. connect() is now at the top level.
fix
Replace import with `from librouteros import connect`.
AttributeError: module 'librouteros' has no attribute 'Login'
The Login class was removed in version 4.0.0.
fix
Use the connect() function instead.
Upgrade
Version history
4.1.1latest on PyPI · released Jun 10, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
librouteros — pip install librouteros · libregistry