Community discussions

 
User avatar
vklpt
just joined
Topic Author
Posts: 16
Joined: Mon Feb 18, 2019 1:13 pm
Location: Izhevsk
Contact:

Scheduler with API support

Sun Jul 14, 2019 2:06 pm

https://github.com/vikilpet/Taskopy

Open source Python scheduler for Windows with RouterOS API support.

Example — add IP from clipboard to address-list "my_list":
def add_ip_to_list(hotkey='alt+ctrl+i'):
    routeros_send(
        [
            '/ip/firewall/address-list/add'
            , '=list=my_list'
            , '=address=' + clip_get()
        ]
        , device_ip='192.168.88.1'
        , device_user='admin'
        , device_pwd='PaSsWoRd'
    )
    msgbox('Done!', timeout=5)

Example — add address to list with HTTP-request:
def address_from_web(data, http=True, submenu='Rare'):
	routeros_send(
		[
			'/ip/firewall/address-list/add'
			, '=list=' + data.listname
			, '=address=' + data.address
		]
		, device_ip='192.168.88.1'
		, device_user='admin'
		, device_pwd='PaSSWorD'
	)
Then you can add address to any address-list with this HTTP request:
http://127.0.0.1/task?address_from_web&listname=my_list&address=1.2.3.4
 
User avatar
vklpt
just joined
Topic Author
Posts: 16
Joined: Mon Feb 18, 2019 1:13 pm
Location: Izhevsk
Contact:

Re: Scheduler with API support

Mon Aug 19, 2019 10:18 pm

New function - routeros_find_send to simplify editing of existing settings.
Remove static items from address-list:
routeros_find_send(
	cmd_find=[
		'/ip/firewall/address-list/print'
		, '?list=MY_LIST'
		, '?dynamic=false'
	]
	, cmd_send=['/ip/firewall/address-list/remove']
	, device_ip='192.168.88.1'
	, device_user='admin'
	, device_pwd='pA$$w0rd'
)

Who is online

Users browsing this forum: No registered users and 6 guests