Exemplo n.º 1
0
    def get_uri(self):
        """
        Returns a URI formatted representation of the host, including all
        of it's attributes except for the name. Uses the
        address, not the name of the host to build the URI.

        @rtype:  str
        @return: A URI.
        """
        url = Url()
        url.protocol = self.get_protocol()
        url.hostname = self.get_address()
        url.port = self.get_tcp_port()
        url.vars = dict((k, to_list(v))
                        for (k, v) in self.get_all().iteritems()
                        if isinstance(v, str) or isinstance(v, list))

        if self.account:
            url.username = self.account.get_name()
            url.password1 = self.account.get_password()
            url.password2 = self.account.authorization_password

        return str(url)