Lines Matching defs:host
8 >>> ftp = FTP('ftp.python.org') # connect to host, default port
82 host, user, passwd, acct, timeout
90 Then use self.connect() with optional host and port argument.
102 host = ''
110 # Initialize host to localhost, port to standard ftp port
111 # Optional arguments are host (for connect()),
113 def __init__(self, host='', user='', passwd='', acct='',
116 if host:
117 self.connect(host)
121 def connect(self, host='', port=0, timeout=-999):
122 '''Connect to host. Arguments are:
123 - host: hostname to connect to (string, default previous host)
126 if host != '':
127 self.host = host
132 self.sock = socket.create_connection((self.host, self.port), self.timeout)
251 def sendport(self, host, port):
252 '''Send a PORT command with the current host and the given
255 hbytes = host.split('.')
261 def sendeprt(self, host, port):
262 '''Send a EPRT command with the current host and the given port number.'''
270 fields = ['', repr(af), host, repr(port), '']
296 host = self.sock.getsockname()[0] # Get proper host
298 resp = self.sendport(host, port)
300 resp = self.sendeprt(host, port)
307 host, port = parse227(self.sendcmd('PASV'))
309 host, port = parse229(self.sendcmd('EPSV'), self.sock.getpeername())
310 return host, port
329 host, port = self.makepasv()
330 conn = socket.create_connection((host, port), self.timeout)
385 # host or country.
634 def __init__(self, host='', user='', passwd='', acct='', keyfile=None,
639 FTP.__init__(self, host, user, passwd, acct, timeout)
797 Return ('host.addr.as.numbers', port#) tuple.'''
809 host = '.'.join(numbers[:4])
811 return host, port
817 Return ('host.addr.as.numbers', port#) tuple.'''
831 host = peer[0]
833 return host, port
917 host = user = passwd = acct = None
929 host = w2.lower()
950 if host:
951 if host in self.__hosts:
953 self.__hosts[host]
957 self.__hosts[host] = user, passwd, acct
964 def get_account(self, host):
965 """Returns login information for the named host.
971 host = host.lower()
973 if host in self.__hosts:
974 user, passwd, acct = self.__hosts[host]
992 Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] [file] ...
1012 host = sys.argv[1]
1013 ftp = FTP(host)
1024 userid, passwd, acct = netrc.get_account(host)
1026 # no account for host