How to run script from Client to RouterOS

Hello guys,

I need help for my situation. I created the api client in python which i got it from http://mikrotik.net.pl/wiki/API but now i want to create a script to check IP address of my Mikrotik from my client without me typing anything (as if its automated). So when i run the script it will connect my client to my Mikrotik then login for me and then print out the IP address.
My current situation is i am able to connect to my Mikrotik and print the ip address but all this need to be manually typed.
I tried googling for the code or steps but couldn’t find anything related to it. So i am hoping if someone here knows what i want to do and help me by giving me a head start.
If anyone knows how to do it, mind showing me the code you added to the python script so i can have a better idea of what is needed.
please help me! Thank you!!

One way would be to modify the main() function to use hard coded input instead of reading from stdin. The actual part is communicating with RouterOS is the ApiRos class, not main().

Although I would instead recommend you get and learn to use an “actual” library. There are a few other Python API clients out there, many of them better. Not to mention that the original manual page for the API also lists API clients in many other programming languages. I mean, if you’re more familiar with one of the other ones, maybe use it instead?