Initialization method (called by class instantiation). Initialize host to localhost, port to standard ftp port. Optional arguments are host (for connect()), and user, passwd, acct (for login()).
(self, host='', user='', passwd='', acct='',
timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *,
encoding='utf-8')
| 107 | trust_server_pasv_ipv4_address = False |
| 108 | |
| 109 | def __init__(self, host='', user='', passwd='', acct='', |
| 110 | timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, |
| 111 | encoding='utf-8'): |
| 112 | """Initialization method (called by class instantiation). |
| 113 | Initialize host to localhost, port to standard ftp port. |
| 114 | Optional arguments are host (for connect()), |
| 115 | and user, passwd, acct (for login()). |
| 116 | """ |
| 117 | self.encoding = encoding |
| 118 | self.source_address = source_address |
| 119 | self.timeout = timeout |
| 120 | if host: |
| 121 | self.connect(host) |
| 122 | if user: |
| 123 | self.login(user, passwd, acct) |
| 124 | |
| 125 | def __enter__(self): |
| 126 | return self |