def create_url(hostname, port=None, isSecure=False, path=None, params=None):
 if (port is not None):
  netloc = ('%s:%d' % (hostname, port))
 elif isSecure:
  netloc = ('%s:443' % hostname)
 else:
  netloc = ('%s:80' % hostname)
 if isSecure:
  scheme = 'wss'
 else:
  scheme = 'ws'
 if (path is not None):
  ppath = urllib.parse.quote(path)
 else:
  ppath = '/'
 if (params is not None):
  query = urllib.parse.urlencode(params)
 else:
  query = None
 return urllib.parse.urlunparse((scheme, netloc, ppath, None, query, None))

def create_url ( hostname , port = None , isSecure = False , path = None , params = None ) : if ( port is not None ) : netloc = ( '%s:%d' % ( hostname , port ) ) elif isSecure : netloc = ( '%s:443' % hostname ) else : netloc = ( '%s:80' % hostname ) if isSecure : scheme = 'wss' else : scheme = 'ws' if ( path is not None ) : ppath = urllib . parse . quote ( path ) else : ppath = '/' if ( params is not None ) : query = urllib . parse . urlencode ( params ) else : query = None return urllib . parse . urlunparse ( ( scheme , netloc , ppath , None , query , None ) )
create a rawsocket url from components .