(self, user = '', passwd = '', acct = '')
return resp
Login, default anonymous.
Login, default anonymous.
Login default anonymous .
def login(self, user = '', passwd = '', acct = ''):
        '''Login, default anonymous.'''
        if not user:
            user = 'anonymous'
        if not passwd:
            passwd = ''
        if not acct:
            acct = ''
        if user == 'anonymous' and passwd in {'', '-'}:
            # If there is no anonymous ftp password specified
            # then we'll just use anonymous@
            # We don't send any other thing because:
            # - We want to remain anonymous
            # - We want to stop SPAM
            # - We don't want to let ftp sites to discriminate by the user,
            #   host or country.
            passwd = passwd + 'anonymous@'
        resp = self.sendcmd('USER ' + user)
        if resp[0] == '3':
            resp = self.sendcmd('PASS ' + passwd)
        if resp[0] == '3':
            resp = self.sendcmd('ACCT ' + acct)
        if resp[0] != '2':
            raise error_reply(resp)
        return resp
def login ( self , user = '' , passwd = '' , acct = '' ) : if not user : user = 'anonymous' if not passwd : passwd = '' if not acct : acct = '' if user == 'anonymous' and passwd in { '' , '-' } : # If there is no anonymous ftp password specified # then we'll just use anonymous@ # We don't send any other thing because: # - We want to remain anonymous # - We want to stop SPAM # - We don't want to let ftp sites to discriminate by the user, #   host or country. passwd = passwd + 'anonymous@' resp = self . sendcmd ( 'USER ' + user ) if resp [ 0 ] == '3' : resp = self . sendcmd ( 'PASS ' + passwd ) if resp [ 0 ] == '3' : resp = self . sendcmd ( 'ACCT ' + acct ) if resp [ 0 ] != '2' : raise error_reply ( resp ) return resp