Thanks Abhilash. The plan is to only expose the API via our private subnets in AWS and using a security group to restrict access to a specific instance(s).
I just tried setting up mailmanclient on a Linux system running Python 3.6.3 and had a similar issue trying to run client.domains via mailmanclient. Note: My test instance hosting the Mailman API is running Python 3.6.8.
See client.system output below.
client.system {'mailman_version': 'GNU Mailman 3.2.2 (La Villa Strangiato)', 'python_version': '3.6.8 (default, Apr 25 2019, 21:02:35) \n[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]', 'api_version': '3.1', 'self_link': 'http://localhost:8001/3.1/system/versions', 'http_etag': '"a4e539145192f2cd02e837a2b905583fe4649fdc"'}
Here's the full error traceback for client.domains. The significant lines indicate some kind of socket error.
client.domains Traceback (most recent call last): File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/mailmanclient/restbase/connection.py", line 95, in call response, content = Http().request(url, method, data_str, headers) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1926, in request cachekey, File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1595, in _request conn, request_uri, method, body, headers File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1501, in _conn_request conn.connect() File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1207, in connect raise socket_err File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/httplib2/__init__.py", line 1181, in connect self.sock.connect((self.host, self.port) + sa[2:]) ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/mailmanclient/restobjects/domain.py", line 35, in __repr__ return '<Domain {0!r}>'.format(self.mail_host) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/mailmanclient/restbase/base.py", line 121, in __getattr__ return self._get(name) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/mailmanclient/restbase/base.py", line 87, in _get return self.rest_data.get(key) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/mailmanclient/restbase/base.py", line 76, in rest_data response, content = self._connection.call(self._url) File "/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages/mailmanclient/restbase/connection.py", line 109, in call raise MailmanConnectionError('Could not connect to Mailman API') mailmanclient.restbase.connection.MailmanConnectionError: Could not connect to Mailman API