亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftplib.py

?? mallet是自然語言處理、機器學習領域的一個開源項目。
?? PY
?? 第 1 頁 / 共 2 頁
字號:
"""An FTP client class and some helper functions.Based on RFC 959: File Transfer Protocol (FTP), by J. Postel and J. ReynoldsExample:>>> from ftplib import FTP>>> ftp = FTP('ftp.python.org') # connect to host, default port>>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@'230 Guest login ok, access restrictions apply.'>>> ftp.retrlines('LIST') # list directory contentstotal 9drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 .drwxr-xr-x   8 root     wheel        1024 Jan  3  1994 ..drwxr-xr-x   2 root     wheel        1024 Jan  3  1994 bindrwxr-xr-x   2 root     wheel        1024 Jan  3  1994 etcd-wxrwxr-x   2 ftp      wheel        1024 Sep  5 13:43 incomingdrwxr-xr-x   2 root     wheel        1024 Nov 17  1993 libdrwxr-xr-x   6 1094     wheel        1024 Sep 13 19:07 pubdrwxr-xr-x   3 root     wheel        1024 Jan  3  1994 usr-rw-r--r--   1 root     root          312 Aug  1  1994 welcome.msg'226 Transfer complete.'>>> ftp.quit()'221 Goodbye.'>>>A nice test that reveals some of the network dialogue would be:python ftplib.py -d localhost -l -p -l"""## Changes and improvements suggested by Steve Majewski.# Modified by Jack to work on the mac.# Modified by Siebren to support docstrings and PASV.#import osimport sysimport string# Import SOCKS module if it exists, else standard socket module sockettry:    import SOCKS; socket = SOCKS; del SOCKS # import SOCKS as socket    from socket import getfqdn; socket.getfqdn = getfqdn; del getfqdnexcept ImportError:    import socket__all__ = ["FTP","Netrc"]# Magic number from <socket.h>MSG_OOB = 0x1                           # Process data out of band# The standard FTP server control portFTP_PORT = 21# Exception raised when an error or invalid response is receivedclass Error(Exception): passclass error_reply(Error): pass          # unexpected [123]xx replyclass error_temp(Error): pass           # 4xx errorsclass error_perm(Error): pass           # 5xx errorsclass error_proto(Error): pass          # response does not begin with [1-5]# All exceptions (hopefully) that may be raised here and that aren't# (always) programming errors on our sideall_errors = (Error, socket.error, IOError, EOFError)# Line terminators (we always output CRLF, but accept any of CRLF, CR, LF)CRLF = '\r\n'# The class itselfclass FTP:    '''An FTP client class.    To create a connection, call the class using these argument:            host, user, passwd, acct    These are all strings, and have default value ''.    Then use self.connect() with optional host and port argument.    To download a file, use ftp.retrlines('RETR ' + filename),    or ftp.retrbinary() with slightly different arguments.    To upload a file, use ftp.storlines() or ftp.storbinary(),    which have an open file as argument (see their definitions    below for details).    The download/upload functions first issue appropriate TYPE    and PORT or PASV commands.'''    debugging = 0    host = ''    port = FTP_PORT    sock = None    file = None    welcome = None    passiveserver = 1    # 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())    def __init__(self, host='', user='', passwd='', acct=''):        if host:            self.connect(host)            if user: self.login(user, passwd, acct)    def connect(self, host = '', port = 0):        '''Connect to host.  Arguments are:        - host: hostname to connect to (string, default previous host)        - port: port to connect to (integer, default previous port)'''        if host: self.host = host        if port: self.port = port        msg = "getaddrinfo returns an empty list"        for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):            af, socktype, proto, canonname, sa = res            try:                self.sock = socket.socket(af, socktype, proto)                self.sock.connect(sa)            except socket.error, msg:                if self.sock:                    self.sock.close()                self.sock = None                continue            break        if not self.sock:            raise socket.error, msg        self.af = af        self.file = self.sock.makefile('rb')        self.welcome = self.getresp()        return self.welcome    def getwelcome(self):        '''Get the welcome message from the server.        (this is read and squirreled away by connect())'''        if self.debugging:            print '*welcome*', self.sanitize(self.welcome)        return self.welcome    def set_debuglevel(self, level):        '''Set the debugging level.        The required argument level means:        0: no debugging output (default)        1: print commands and responses but not body text etc.        2: also print raw lines read and sent before stripping CR/LF'''        self.debugging = level    debug = set_debuglevel    def set_pasv(self, val):        '''Use passive or active mode for data transfers.        With a false argument, use the normal PORT mode,        With a true argument, use the PASV command.'''        self.passiveserver = val    # Internal: "sanitize" a string for printing    def sanitize(self, s):        if s[:5] == 'pass ' or s[:5] == 'PASS ':            i = len(s)            while i > 5 and s[i-1] in '\r\n':                i = i-1            s = s[:5] + '*'*(i-5) + s[i:]        return `s`    # Internal: send one line to the server, appending CRLF    def putline(self, line):        line = line + CRLF        if self.debugging > 1: print '*put*', self.sanitize(line)        self.sock.sendall(line)    # Internal: send one command to the server (through putline())    def putcmd(self, line):        if self.debugging: print '*cmd*', self.sanitize(line)        self.putline(line)    # Internal: return one line from the server, stripping CRLF.    # Raise EOFError if the connection is closed    def getline(self):        line = self.file.readline()        if self.debugging > 1:            print '*get*', self.sanitize(line)        if not line: raise EOFError        if line[-2:] == CRLF: line = line[:-2]        elif line[-1:] in CRLF: line = line[:-1]        return line    # Internal: get a response from the server, which may possibly    # consist of multiple lines.  Return a single string with no    # trailing CRLF.  If the response consists of multiple lines,    # these are separated by '\n' characters in the string    def getmultiline(self):        line = self.getline()        if line[3:4] == '-':            code = line[:3]            while 1:                nextline = self.getline()                line = line + ('\n' + nextline)                if nextline[:3] == code and \                        nextline[3:4] != '-':                    break        return line    # Internal: get a response from the server.    # Raise various errors if the response indicates an error    def getresp(self):        resp = self.getmultiline()        if self.debugging: print '*resp*', self.sanitize(resp)        self.lastresp = resp[:3]        c = resp[:1]        if c == '4':            raise error_temp, resp        if c == '5':            raise error_perm, resp        if c not in '123':            raise error_proto, resp        return resp    def voidresp(self):        """Expect a response beginning with '2'."""        resp = self.getresp()        if resp[0] != '2':            raise error_reply, resp        return resp    def abort(self):        '''Abort a file transfer.  Uses out-of-band data.        This does not follow the procedure from the RFC to send Telnet        IP and Synch; that doesn't seem to work with the servers I've        tried.  Instead, just send the ABOR command as OOB data.'''        line = 'ABOR' + CRLF        if self.debugging > 1: print '*put urgent*', self.sanitize(line)        self.sock.sendall(line, MSG_OOB)        resp = self.getmultiline()        if resp[:3] not in ('426', '226'):            raise error_proto, resp    def sendcmd(self, cmd):        '''Send a command and return the response.'''        self.putcmd(cmd)        return self.getresp()    def voidcmd(self, cmd):        """Send a command and expect a response beginning with '2'."""        self.putcmd(cmd)        return self.voidresp()    def sendport(self, host, port):        '''Send a PORT command with the current host and the given        port number.        '''        hbytes = host.split('.')        pbytes = [`port/256`, `port%256`]        bytes = hbytes + pbytes        cmd = 'PORT ' + ','.join(bytes)        return self.voidcmd(cmd)    def sendeprt(self, host, port):        '''Send a EPRT command with the current host and the given port number.'''        af = 0        if self.af == socket.AF_INET:            af = 1        if self.af == socket.AF_INET6:            af = 2        if af == 0:            raise error_proto, 'unsupported address family'        fields = ['', `af`, host, `port`, '']        cmd = 'EPRT ' + string.joinfields(fields, '|')        return self.voidcmd(cmd)    def makeport(self):        '''Create a new socket and send a PORT command for it.'''        msg = "getaddrinfo returns an empty list"        sock = None        for res in socket.getaddrinfo(None, 0, self.af, socket.SOCK_STREAM, 0, socket.AI_PASSIVE):            af, socktype, proto, canonname, sa = res            try:                sock = socket.socket(af, socktype, proto)                sock.bind(sa)            except socket.error, msg:                if sock:                    sock.close()                sock = None                continue            break        if not sock:            raise socket.error, msg        sock.listen(1)        port = sock.getsockname()[1] # Get proper port        host = self.sock.getsockname()[0] # Get proper host        if self.af == socket.AF_INET:            resp = self.sendport(host, port)        else:            resp = self.sendeprt(host, port)        return sock    def makepasv(self):        if self.af == socket.AF_INET:            host, port = parse227(self.sendcmd('PASV'))        else:            host, port = parse229(self.sendcmd('EPSV'), self.sock.getpeername())        return host, port    def ntransfercmd(self, cmd, rest=None):        """Initiate a transfer over the data connection.        If the transfer is active, send a port command and the        transfer command, and accept the connection.  If the server is        passive, send a pasv command, connect to it, and start the        transfer command.  Either way, return the socket for the        connection and the expected size of the transfer.  The        expected size may be None if it could not be determined.        Optional `rest' argument can be a string that is sent as the        argument to a RESTART command.  This is essentially a server        marker used to tell the server to skip over any data up to the        given marker.        """        size = None        if self.passiveserver:            host, port = self.makepasv()            af, socktype, proto, canon, sa = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0]            conn = socket.socket(af, socktype, proto)            conn.connect(sa)            if rest is not None:                self.sendcmd("REST %s" % rest)            resp = self.sendcmd(cmd)            if resp[0] != '1':                raise error_reply, resp        else:            sock = self.makeport()            if rest is not None:                self.sendcmd("REST %s" % rest)            resp = self.sendcmd(cmd)            if resp[0] != '1':                raise error_reply, resp            conn, sockaddr = sock.accept()        if resp[:3] == '150':            # this is conditional in case we received a 125            size = parse150(resp)        return conn, size    def transfercmd(self, cmd, rest=None):        """Like ntransfercmd() but returns only the socket."""        return self.ntransfercmd(cmd, rest)[0]    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 retrbinary(self, cmd, callback, blocksize=8192, rest=None):        """Retrieve data in binary mode.        `cmd' is a RETR command.  `callback' is a callback function is        called for each block.  No more than `blocksize' number of        bytes will be read from the socket.  Optional `rest' is passed        to transfercmd().        A new port is created for you.  Return the response code.        """        self.voidcmd('TYPE I')        conn = self.transfercmd(cmd, rest)        while 1:            data = conn.recv(blocksize)            if not data:                break            callback(data)        conn.close()        return self.voidresp()    def retrlines(self, cmd, callback = None):        '''Retrieve data in line mode.        The argument is a RETR or LIST command.        The callback function (2nd argument) is called for each line,        with trailing CRLF stripped.  This creates a new port for you.        print_line() is the default callback.'''        if not callback: callback = print_line        resp = self.sendcmd('TYPE A')        conn = self.transfercmd(cmd)        fp = conn.makefile('rb')        while 1:            line = fp.readline()            if self.debugging > 2: print '*retr*', `line`            if not line:                break

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美不卡123| 日韩电影免费在线看| 国产不卡视频一区二区三区| 欧美精品一区二区蜜臀亚洲| 韩国在线一区二区| 久久久一区二区三区| 国产不卡在线一区| 亚洲精品免费播放| 欧美顶级少妇做爰| 另类小说视频一区二区| 久久综合色综合88| 99视频国产精品| 一区二区三区中文字幕| 777午夜精品视频在线播放| 日本va欧美va欧美va精品| 久久婷婷国产综合国色天香| 不卡影院免费观看| 亚洲成人自拍偷拍| 精品久久久久一区| 99久久精品一区二区| 亚洲一区二区三区视频在线| 日韩一区二区在线观看视频 | 亚洲成在人线免费| 精品免费99久久| www.视频一区| 日韩不卡一区二区| 国产精品毛片久久久久久久| 欧美午夜精品一区二区三区| 三级欧美在线一区| 国产欧美一区二区在线观看| 色婷婷综合五月| 激情综合一区二区三区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 欧美三级日本三级少妇99| 国产一区二区在线免费观看| 亚洲区小说区图片区qvod| 91精品国产91久久久久久一区二区| 国产一区在线不卡| 亚洲高清三级视频| 国产人伦精品一区二区| 欧美日韩国产在线播放网站| 国产激情视频一区二区三区欧美 | 精品剧情在线观看| 色婷婷av一区二区三区大白胸 | 精品精品国产高清一毛片一天堂| av亚洲精华国产精华精华| 男女男精品视频网| 一区二区三区在线免费观看| 久久日韩粉嫩一区二区三区| 欧美精品自拍偷拍动漫精品| 成人美女视频在线观看18| 麻豆精品久久久| 亚洲自拍偷拍欧美| 国产精品福利电影一区二区三区四区| 日韩一区二区三区精品视频 | 欧美午夜一区二区三区| 国产传媒久久文化传媒| 奇米影视7777精品一区二区| 夜夜嗨av一区二区三区四季av| 久久久久久久久久久久久久久99| 91精品国产丝袜白色高跟鞋| 在线视频国内自拍亚洲视频| 成人av网址在线观看| 国产成人亚洲精品狼色在线| 国产精品1区2区3区在线观看| 日韩精品三区四区| 亚洲成av人片观看| 樱桃国产成人精品视频| 一区免费观看视频| 国产精品国产三级国产普通话三级 | 日韩免费高清视频| 在线不卡一区二区| 8x福利精品第一导航| 欧美视频在线一区二区三区| 色八戒一区二区三区| 色噜噜夜夜夜综合网| 91在线小视频| 91性感美女视频| 91丨九色porny丨蝌蚪| 91在线视频播放地址| av资源站一区| 99视频有精品| 99久久免费视频.com| 99久久免费视频.com| 91在线免费看| 欧美午夜宅男影院| 欧美精品99久久久**| 91精品国产麻豆国产自产在线| 欧美精品第一页| 日韩一区二区在线看| www国产亚洲精品久久麻豆| 精品国产一区二区国模嫣然| 久久久不卡影院| 国产精品久久久久一区二区三区| 国产精品久久二区二区| 亚洲精品乱码久久久久久黑人 | 久久久亚洲午夜电影| 欧美国产视频在线| 亚洲欧美激情小说另类| 亚洲国产精品久久一线不卡| 日韩和的一区二区| 国产乱人伦精品一区二区在线观看| 国产剧情一区二区三区| 99综合影院在线| 欧美日韩一区三区| 精品福利在线导航| 国产精品久99| 亚洲成a人片在线不卡一二三区| 丝袜美腿亚洲综合| 国产精品综合二区| 日本伦理一区二区| 欧美一级在线视频| 国产精品免费网站在线观看| 一区二区三区视频在线观看| 美女视频网站久久| 99热精品国产| 在线播放91灌醉迷j高跟美女| 久久你懂得1024| 一级中文字幕一区二区| 捆绑紧缚一区二区三区视频| 99在线精品视频| 日韩精品中午字幕| 最新欧美精品一区二区三区| 青草国产精品久久久久久| 99综合电影在线视频| 日韩精品最新网址| 亚洲综合免费观看高清在线观看 | 国产综合久久久久久久久久久久| 99久久精品国产网站| 日韩丝袜美女视频| 一区二区三区资源| 高清不卡一二三区| 欧美一区二区私人影院日本| 综合亚洲深深色噜噜狠狠网站| 免费成人av资源网| 欧美在线观看一区二区| 国产精品系列在线| 久久精品噜噜噜成人av农村| 色婷婷精品大视频在线蜜桃视频| 精品成人私密视频| 日韩高清不卡一区二区三区| 99re这里只有精品视频首页| 欧美哺乳videos| 天天色天天操综合| 99精品久久只有精品| 国产亚洲综合av| 久久国产精品99精品国产| 欧美性猛片aaaaaaa做受| 国产精品久久久久毛片软件| 国产在线看一区| 日韩视频一区二区三区在线播放| 亚洲综合男人的天堂| 91免费看`日韩一区二区| 日本一区免费视频| 国产在线播放一区| 日韩欧美一二区| 日韩精品乱码av一区二区| 在线精品观看国产| 亚洲美女少妇撒尿| 99久久精品国产精品久久| 欧美激情自拍偷拍| 国产精品白丝jk黑袜喷水| 亚洲精品一区二区三区影院 | 欧美午夜精品理论片a级按摩| 中文字幕五月欧美| 成人免费视频播放| 欧美国产成人在线| 成人性生交大片| 国产精品欧美一区二区三区| 国产suv精品一区二区6| 久久综合给合久久狠狠狠97色69| 六月丁香婷婷色狠狠久久| 精品久久久久久久久久久久包黑料 | 日韩国产高清在线| 日韩一区二区不卡| 久草精品在线观看| 久久蜜桃av一区精品变态类天堂| 精品在线播放免费| 精品国产免费一区二区三区四区| 国产一区免费电影| 欧美激情综合五月色丁香 | 色一情一伦一子一伦一区| 亚洲精品视频一区| 欧洲国产伦久久久久久久| 亚洲福利视频导航| 欧美一区二区视频免费观看| 久久99国产精品免费| 国产三级精品三级在线专区| av影院午夜一区| 亚洲国产成人精品视频| 91精品久久久久久久91蜜桃| 精品中文字幕一区二区小辣椒| 一级中文字幕一区二区| 91精品国产麻豆| 成人深夜在线观看| 亚洲欧美日韩精品久久久久| 欧美日韩国产色站一区二区三区| 蜜臀国产一区二区三区在线播放| 国产亚洲综合av| 欧洲视频一区二区|