Connection refused error - ADSB - Python script


We are getting below error when we try to access ADS-B feed through through Python script. We are able to execute with OpenSSL but not through Python.
Kindly help us in this.

Error :
=========== RESTART: C:\Users\E356488\Desktop\Python\ ===========
Traceback (most recent call last):
File “C:\Users\E356488\Desktop\Python\”, line 35, in
ssl_sock.connect((‘’, 1501))
File “C:\Users\E356488\AppData\Local\Programs\Python\Python35-32\lib\”, line 1014, in connect
self._real_connect(addr, False)
File “C:\Users\E356488\AppData\Local\Programs\Python\Python35-32\lib\”, line 1001, in _real_connect
socket.connect(self, addr)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

As long as your python code is using the same hostname and port number that is originally specified in the sample on our website, then it should work if your network and/or firewall are properly configured. Please speak to your IT staff if you need to arrange for your firewall to allow outgoing connections to our server on that port number.

ssl_sock = context.wrap_socket(s, server_hostname ='')
ssl_sock.connect(('', 1501))
print("Connection succeeded")

You can also use the “openssl s_client” command that is listed earlier in the documentation page to verify that you can connect to our server’s address.