socialwifi / RouterOS-api

Python API to RouterBoard devices produced by MikroTik.
MIT License
251 stars 100 forks source link

'Error "no such command" executing command #55

Open eoporto opened 4 years ago

eoporto commented 4 years ago

Miktortik CLI command: /ip hotspot user print where name=User1"

Applied using code below: api.get_binary_resource('/').call('ip/hotspot/user/print/where', {'name' : 'User1'})

Error: routeros_api.exceptions.RouterOsApiCommunicationError: ('Error "no such command" executing command /ip/hotspot/user/print/where =name=User1 .tag=3', 'no such command')

What is the correct way to implement the CLI command to python code?

Thank you.

crbertoldo commented 4 years ago

https://wiki.mikrotik.com/wiki/API_command_notes

E.g. /ip/address/print:

ip_addresses = api.get_resource('/ip/address')  # do not put print baucase it will cause redundancy
print(ip_addresses.get())