Python API doesn't connect

Hello ,
I have created a python3 code for enter the router and change nat rule
work on 1 computer and doesn’t work on another computer (copy paste the same code)
what could be the reason?
this is the error I’m getting

Traceback (most recent call last):
  File "Documents/UDP_Server.py", line 63, in <module>
    ConnetToRouter("true")
  File "Documents/UDP_Server.py", line 28, in ConnetToRouter
    api = connection.get_api()
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api.py", line 52, in get_api
    self.api.login(self.username, self.password, self.plaintext_login)
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api.py", line 87, in login
    response = self.get_binary_resource('/').call('login',{ 'name': login, 'password': password })
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/resource.py", line 39, in call
    additional_queries=additional_queries).get()
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/encoding_decorator.py", line 31, in get
    response = self.inner.get()
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/async_decorator.py", line 17, in get
    self.response = self.receiver.receive(self.tag)
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/exception_decorator.py", line 19, in receive
    self.handle_exception(e)
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/exception_decorator.py", line 37, in handle_exception
    raise exception
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/exception_decorator.py", line 17, in receive
    return self.inner.receive(tag)
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/key_cleaner_decorator.py", line 14, in receive
    answers = self.inner.receive(tag)
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/base.py", line 46, in receive
    response_buffor_manager.step_to_finish_response()
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/base.py", line 130, in step_to_finish_response
    self.receiver.process_single_response()
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/base.py", line 59, in process_single_response
    response = self.receive_single_response()
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_communicator/base.py", line 65, in receive_single_response
    serialized = self.base.receive_sentence()
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/base_api.py", line 31, in receive_sentence
    return list(iter(self.receive_word, b''))
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/base_api.py", line 38, in receive_word
    expected_length = decode_length(self.socket.receive)
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/base_api.py", line 74, in decode_length
    first = ord(read(1))
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_socket.py", line 72, in receive
    return self._receive_and_check_connection(length)
  File "/usr/local/lib/python3.7/dist-packages/routeros_api/api_socket.py", line 84, in _receive_and_check_connection
    raise exceptions.RouterOsApiConnectionClosedError
routeros_api.exceptions.RouterOsApiConnectionClosedError

and this is the code

import socket
import sys
import routeros_api
import json

IP = 10.0.0.1"
## connect to the router
def ConnetToRouter(status):
    connection = routeros_api.RouterOsApiPool(IP, username='APIUser', password='ApiPass0rd',plaintext_login=True)
    api = connection.get_api()
    NatRule =  api.get_resource('/ip/firewall/nat')
    RuleID = NatRule.get(comment='test')[0]["id"]
    NatRule.set(id=RuleID,disabled=status)
    connection.disconnect()

####testing
ConnectToRouter("true")

If port is open, check this working Python client:
https://wiki.mikrotik.com/wiki/Manual:API_Python3

I’m sorry

in the router I didn’t allow the all internel network to connect to the router …
I forgot I change it to work only from 1 address

I feel dumb now :neutral_face: