MCPcopy Index your code
hub / github.com/python/cpython / login

Method login

Lib/ftplib.py:395–419  ·  view source on GitHub ↗

Login, default anonymous.

(self, user = '', passwd = '', acct = '')

Source from the content-addressed store, hash-verified

393 return self.ntransfercmd(cmd, rest)[0]
394
395 def login(self, user = '', passwd = '', acct = ''):
396 '''Login, default anonymous.'''
397 if not user:
398 user = 'anonymous'
399 if not passwd:
400 passwd = ''
401 if not acct:
402 acct = ''
403 if user == 'anonymous' and passwd in {'', '-'}:
404 # If there is no anonymous ftp password specified
405 # then we'll just use anonymous@
406 # We don't send any other thing because:
407 # - We want to remain anonymous
408 # - We want to stop SPAM
409 # - We don't want to let ftp sites to discriminate by the user,
410 # host or country.
411 passwd = passwd + 'anonymous@'
412 resp = self.sendcmd('USER ' + user)
413 if resp[0] == '3':
414 resp = self.sendcmd('PASS ' + passwd)
415 if resp[0] == '3':
416 resp = self.sendcmd('ACCT ' + acct)
417 if resp[0] != '2':
418 raise error_reply(resp)
419 return resp
420
421 def retrbinary(self, cmd, callback, blocksize=8192, rest=None):
422 """Retrieve data in binary mode. A new port is created for you.

Callers 15

__init__Method · 0.95
testFunction · 0.95
loginMethod · 0.45
test_loginMethod · 0.45
test_loginMethod · 0.45
test_cccMethod · 0.45
test_with_statementMethod · 0.45
test_idle_deniedMethod · 0.45
test_idle_iterMethod · 0.45
test_idle_burstMethod · 0.45

Calls 2

sendcmdMethod · 0.95
error_replyClass · 0.85

Tested by 15

test_loginMethod · 0.36
test_loginMethod · 0.36
test_cccMethod · 0.36
test_with_statementMethod · 0.36
test_idle_deniedMethod · 0.36
test_idle_iterMethod · 0.36
test_idle_burstMethod · 0.36
test_loginMethod · 0.36
test_logoutMethod · 0.36