def proxy_url(hostname, username=None, password=None, port=0, scheme='http'):
    """
    @return: absolute proxy url
    @raise SoapException: if scheme or hostname is empty
    """
    if util.empty(hostname):
        raise SoapException('Empty hostname')

    if util.empty(scheme):
        raise SoapException('Empty scheme')

    hostport = hostname
    if port > 0 and (scheme != 'http' or port != 80):
        hostport = '%s:%s' % (hostname, port)

    userpass = ''
    if not util.empty(username):
        userpass = '%s:%s@' % (username, password)

    url = '%s://%s%s' % (scheme, userpass, hostport)

    return url
def proxy_url ( hostname , username = None , password = None , port = 0 , scheme = 'http' ) : if util . empty ( hostname ) : raise SoapException ( 'Empty hostname' ) if util . empty ( scheme ) : raise SoapException ( 'Empty scheme' ) hostport = hostname if port > 0 and ( scheme != 'http' or port != 80 ) : hostport = '%s:%s' % ( hostname , port ) userpass = '' if not util . empty ( username ) : userpass = '%s:%s@' % ( username , password ) url = '%s://%s%s' % ( scheme , userpass , hostport ) return url
@return: absolute proxy url
    @raise SoapException: if scheme or hostname is empty