当前位置: 首页>>代码示例>>Python>>正文


Python FTP_TLS.set_debuglevel方法代码示例

本文整理汇总了Python中ftplib.FTP_TLS.set_debuglevel方法的典型用法代码示例。如果您正苦于以下问题:Python FTP_TLS.set_debuglevel方法的具体用法?Python FTP_TLS.set_debuglevel怎么用?Python FTP_TLS.set_debuglevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ftplib.FTP_TLS的用法示例。


在下文中一共展示了FTP_TLS.set_debuglevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sendPackagesFtp

# 需要导入模块: from ftplib import FTP_TLS [as 别名]
# 或者: from ftplib.FTP_TLS import set_debuglevel [as 别名]
def sendPackagesFtp():
    print "---- Send packages by FTP"
    global serverFtp
    global userFtp
    global passFtp

    from ftplib import FTP_TLS
    ftps = FTP_TLS(serverFtp)
    ftps.set_debuglevel(1)
    ftps.login(userFtp, passFtp)
    ftps.prot_p()
    try:
        ftps.sendcmd('MKD ' + '/files/' + strProductVer)
    except Exception:
        print 'Directory already exists'
    ftps.cwd('/files/' + strProductVer)
    
    filesListFtp = ftps.nlst()
    filesList = os.listdir(packagesPath)
    newFilesList = [e for e in filesList if not(e in filesListFtp)]
    
    for fileName in newFilesList:
        ftps.storbinary('STOR ' + fileName, open(packagesPath + '\\' + fileName, 'rb'))

    ftps.quit()
开发者ID:barkinet,项目名称:quite-rss.tools,代码行数:27,代码来源:prepare-install.py

示例2: sendUpdateFilesFtp

# 需要导入模块: from ftplib import FTP_TLS [as 别名]
# 或者: from ftplib.FTP_TLS import set_debuglevel [as 别名]
def sendUpdateFilesFtp():
    print "---- Send update files by FTP"
    global serverFtp
    global userFtp
    global passFtp
    
    from ftplib import FTP_TLS
    ftps = FTP_TLS(serverFtp)
    ftps.set_debuglevel(1)
    ftps.login(userFtp, passFtp)
    ftps.prot_p()
    ftps.cwd('/files/updates')
    
    ftps.storbinary('STOR ' + 'file_list.md5', open(quiterssFileRepoPath + '\\file_list.md5', 'rb'))
    ftps.storbinary('STOR ' + 'VersionNo.h', open(quiterssSourcePath + '\\src\\VersionNo.h', 'rb'))
    ftps.storbinary('STOR ' + 'HISTORY_EN', open(quiterssSourcePath + '\\HISTORY_EN', 'rb'))
    ftps.storbinary('STOR ' + 'HISTORY_RU', open(quiterssSourcePath + '\\HISTORY_RU', 'rb'))
    
    prepareFileList7z = []
    for file in prepareFileList:
        prepareFileList7z.append(file + '.7z')

    for fileName in prepareFileList7z:
        ftps.storbinary('STOR ' + 'windows' + fileName.replace('\\','/'), open(quiterssFileRepoPath + '\\windows' + fileName, 'rb'))

    ftps.quit()
开发者ID:barkinet,项目名称:quite-rss.tools,代码行数:28,代码来源:prepare-install.py

示例3: make_msg

# 需要导入模块: from ftplib import FTP_TLS [as 别名]
# 或者: from ftplib.FTP_TLS import set_debuglevel [as 别名]
    def make_msg(self, args):

        # make connection
        conn = None
        if args.ssl or args.starttls:
            conn = FTP_TLS()
            conn.ssl_version = PROTOCOL_TLSv1
        else:
            conn = FTP()

        if args.verbose:
            conn.set_debuglevel(1)

        conn.connect(args.host, args.port, args.timeout)

        if args.starttls:
            conn.auth()
            conn.prot_p()

        conn.login(args.user, args.password)
        self.conn = conn

        return args.message
开发者ID:holly,项目名称:beretta,代码行数:25,代码来源:ftp.py

示例4: FTPClient

# 需要导入模块: from ftplib import FTP_TLS [as 别名]
# 或者: from ftplib.FTP_TLS import set_debuglevel [as 别名]
class FTPClient(object):
    """Class FTPClient
    """

    _mh = None
    _client = None
    _secured = None
    _host = None
    _port = None
    _user = None
    _passw = None
    _path = None
    _verbose = None
    _is_connected = None

    def __init__(self, secured=False, verbose=False):
        """Class constructor

        Called when the object is initialized 

        Args:
           secured (bool): secured FTP           
           verbose (bool): verbose mode

        """

        self._mh = MasterHead.get_head()

        self._secured = secured
        if (not self._secured):
            self._client = FTP()
        else:
            if (not(version_info[0] == 2 and version_info[1] == 6)):
                self._client = FTP_TLS()
            else:
                raise NotImplementedError(
                    'Secured mode is not supported for Python 2.6')

        self._verbose = verbose
        if (self._verbose):
            self._client.set_debuglevel(2)

    @property
    def client(self):
        """ FTP client property getter """

        return self._client

    @property
    def secured(self):
        """ secured protocol mode property getter """

        return self._secured

    @property
    def host(self):
        """ server host property getter """

        return self._host

    @property
    def port(self):
        """ server port property getter """

        return self._port

    @property
    def user(self):
        """ username property getter """

        return self._user

    @property
    def passw(self):
        """ user password property getter """

        return self._passw

    @property
    def path(self):
        """ remote path property getter """

        return self._path

    @property
    def verbose(self):
        """ verbose mode property getter """

        return self._verbose

    @property
    def is_connected(self):
        """ is_connected property getter """

        return self._is_connected

    def connect(self, host, port=21, user=None, passw=None, path='/', timeout=10):
        """Method connects to server

        Args:
#.........这里部分代码省略.........
开发者ID:hydratk,项目名称:hydratk-lib-network,代码行数:103,代码来源:ftp_client.py


注:本文中的ftplib.FTP_TLS.set_debuglevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。