'New connection to rTorrent
:param uri: RTorrent URL. Supports both http(s) and scgi
:param username: Username for basic auth over http(s)
:param password: Password for basic auth over http(s)'

def __init__(self, uri, username=None, password=None, digest_auth=None, session=None):

    self.uri = uri
    self.username = username
    self.password = password
    self.digest_auth = digest_auth
    self._version = None
    parsed_uri = urlparse(uri)
    if (self.username and self.password and (parsed_uri.scheme not in [u'http', u'https'])):
        raise IOError(u'Username    and    password    only    supported    on    http(s)')
    if (parsed_uri.scheme in [u'http', u'https']):
        sp = xmlrpc_client.ServerProxy
    elif (parsed_uri.scheme == u'scgi'):
        sp = SCGIServerProxy
    elif ((parsed_uri.scheme == u'') and parsed_uri.path):
        self.uri = parsed_uri.path
        sp = SCGIServerProxy
    else:
        raise IOError((u'Unsupported    scheme    %s    for    uri    %s' % (parsed_uri.scheme, self.uri)))
    if (parsed_uri.scheme in [u'http', u'https']):
        self._server = sp(self.uri, transport=HTTPDigestTransport(parsed_uri.scheme, self.digest_auth, self.username, self.password, session))
    else:
        self._server = sp(self.uri)
