Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param tcp:
:return:
"""
host_schema = urllib.parse.urlparse(tcp)
ip = host_schema.hostname
port = host_schema.port
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as sock:
if sock.connect_ex((ip, port)) == 0:
return True # OPEN
else:
return False # closed
class Md(MdApiPy):
"""
"""
def __init__(self, broker_id, investor_id, password, request_id=1):
self.broker_id = broker_id
self.investor_id = investor_id
self.password = password
self.request_id = request_id
def OnRspError(self, pRspInfo, nRequestID, bIsLast):
self.ErrorRspInfo(pRspInfo, nRequestID)
def ErrorRspInfo(self, info, request_id):
"""