亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲二区视频在线| 国产精品久久久久永久免费观看 | 精品三级在线看| 久久国产视频网| 精品88久久久久88久久久| 国产永久精品大片wwwapp| 欧美激情在线看| 91日韩在线专区| 午夜精品福利一区二区三区av| 在线观看不卡一区| 日本网站在线观看一区二区三区| 日韩一区二区免费在线电影| 激情偷乱视频一区二区三区| 国产免费成人在线视频| 91视频在线观看| 婷婷开心激情综合| 国产网站一区二区| 色噜噜偷拍精品综合在线| 五月天激情综合| 亚洲精品一区在线观看| 91在线无精精品入口| 亚洲va国产天堂va久久en| 欧美成人乱码一区二区三区| 国产99久久久久| 亚洲444eee在线观看| 精品久久一二三区| 色综合天天综合色综合av| 免费观看在线综合色| 国产欧美日韩精品一区| 日韩亚洲电影在线| 国产成人精品一区二区三区四区 | 日韩电影在线免费看| 久久久国产精华| 欧美怡红院视频| 国产福利91精品一区二区三区| 亚洲综合色噜噜狠狠| 91精品国产综合久久久蜜臀图片| 高清视频一区二区| 爽好多水快深点欧美视频| 欧美国产亚洲另类动漫| 欧美一区二区三区男人的天堂| 成人a免费在线看| 欧美a一区二区| 亚洲乱码中文字幕| 久久天堂av综合合色蜜桃网| 色婷婷精品大在线视频| 国产精品66部| 三级久久三级久久| 一区二区三区在线观看国产| 久久久久国产免费免费| 欧美一区二区在线免费播放| 91亚洲男人天堂| 国产精品夜夜爽| 蜜桃免费网站一区二区三区| 亚洲午夜精品在线| 最近中文字幕一区二区三区| 精品久久久久久久久久久院品网 | 精品视频999| av高清不卡在线| 国产精品一线二线三线精华| 日韩国产高清影视| 亚洲精选免费视频| 自拍偷自拍亚洲精品播放| 久久久久久久精| 2022国产精品视频| 日韩精品最新网址| 欧美一区二区免费| 欧美精品一二三区| 日本乱人伦一区| 91丨porny丨首页| 99热这里都是精品| 成人午夜av电影| 国产大陆a不卡| 国产精品一区二区你懂的| 激情伊人五月天久久综合| 日本不卡免费在线视频| 午夜欧美在线一二页| 亚洲精品日韩一| 亚洲黄色片在线观看| 亚洲免费av高清| ●精品国产综合乱码久久久久| 国产色婷婷亚洲99精品小说| 欧美精品一区二区三区在线播放| 日韩三级电影网址| 精品久久久久久久久久久久久久久久久 | 日本电影欧美片| 99v久久综合狠狠综合久久| youjizz久久| 91视视频在线观看入口直接观看www| 成人av在线一区二区| 91在线你懂得| 在线观看视频一区二区欧美日韩| 97精品久久久久中文字幕| 色婷婷综合中文久久一本| 在线观看日韩国产| 欧美精品日韩一区| 精品久久久三级丝袜| 久久久三级国产网站| 国产精品久久久久久久久动漫| 欧美国产欧美综合| 最新中文字幕一区二区三区| 一二三区精品福利视频| 亚洲成人av在线电影| 精一区二区三区| 国产精品一区二区三区乱码| av在线免费不卡| 色综合欧美在线视频区| 欧美日韩在线综合| 精品盗摄一区二区三区| 中文字幕免费不卡| 一区二区三区资源| 免费在线一区观看| 国产91在线观看| 在线观看视频91| 精品理论电影在线观看| 亚洲精品欧美激情| 看片的网站亚洲| 9人人澡人人爽人人精品| 欧美酷刑日本凌虐凌虐| 国产校园另类小说区| 一区二区三区.www| 精品制服美女丁香| 91麻豆蜜桃一区二区三区| 日韩一区二区三区视频在线观看| 国产欧美一区二区精品久导航| 一区二区在线观看视频| 国产专区欧美精品| 色婷婷久久久久swag精品 | 国产伦精品一区二区三区免费| 91在线观看免费视频| 日韩欧美一区在线| 中文字幕一区在线观看视频| 免费欧美日韩国产三级电影| 91在线播放网址| 国产午夜精品久久久久久免费视| 水蜜桃久久夜色精品一区的特点| av欧美精品.com| 欧美精品一区二区久久久| 亚洲福利视频导航| 99国产精品久| 中文字幕av一区 二区| 免费成人av在线播放| 欧洲在线/亚洲| 国产精品精品国产色婷婷| 国产一区二区三区免费在线观看 | 蜜臀a∨国产成人精品| 色综合中文字幕国产| 欧美成人video| 日韩精品午夜视频| 91久久精品一区二区二区| 国产精品欧美极品| 精品一区二区三区欧美| 日韩一区二区三区视频| 亚洲一区二区3| 一本一道久久a久久精品综合蜜臀| 欧美精品一区二| 麻豆精品在线看| 日韩一卡二卡三卡四卡| 午夜日韩在线观看| 欧美精品一二三区| 亚洲高清免费在线| 欧美日韩中文一区| 亚洲一区二区三区四区中文字幕| av中文字幕一区| 国产精品久久久久影院色老大 | 麻豆一区二区三| 欧美一区二区三区人| 日韩av中文字幕一区二区| 欧美日韩国产天堂| 亚洲大片精品永久免费| 欧美久久久久久蜜桃| 视频一区欧美精品| 欧美成人福利视频| 国产精品原创巨作av| 国产欧美一二三区| www.欧美亚洲| 亚洲精选在线视频| 欧美理论片在线| 蜜臀国产一区二区三区在线播放| 这里只有精品99re| 韩国视频一区二区| 国产区在线观看成人精品| 成人aa视频在线观看| 亚洲精品一卡二卡| 欧美军同video69gay| 精品综合久久久久久8888| 国产人成亚洲第一网站在线播放 | 中文字幕国产精品一区二区| 大胆亚洲人体视频| 亚洲人成精品久久久久久| 欧美撒尿777hd撒尿| 奇米影视7777精品一区二区| 2022国产精品视频| 91啪在线观看| 午夜国产精品一区| 精品国产乱码久久| 一本久久综合亚洲鲁鲁五月天| 亚洲小说欧美激情另类| 欧美大片免费久久精品三p| 国产成人h网站|