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


Python util.getPassword方法代码示例

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


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

示例1: main

# 需要导入模块: from twisted.python import util [as 别名]
# 或者: from twisted.python.util import getPassword [as 别名]
def main():
    hostname = raw_input('IMAP4 Server Hostname: ')
    port = raw_input('IMAP4 Server Port (the default is 143): ')
    username = raw_input('IMAP4 Username: ')
    password = util.getPassword('IMAP4 Password: ')

    onConn = defer.Deferred(
    ).addCallback(cbServerGreeting, username, password
                  ).addErrback(ebConnection
                               ).addBoth(cbClose)

    factory = SimpleIMAP4ClientFactory(username, onConn)

    from twisted.internet import reactor
    conn = reactor.connectTCP(hostname, int(port), factory)
    reactor.run() 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:18,代码来源:imapclient.py

示例2: getSavePassphrase

# 需要导入模块: from twisted.python import util [as 别名]
# 或者: from twisted.python.util import getPassword [as 别名]
def getSavePassphrase(needed):
    if needed:
        return util.getPassword("Encryption passphrase: ")
    else:
        return None 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:7,代码来源:app.py

示例3: getSavePassphrase

# 需要导入模块: from twisted.python import util [as 别名]
# 或者: from twisted.python.util import getPassword [as 别名]
def getSavePassphrase(needed):
    if needed:
        passphrase = util.getPassword("Encryption passphrase: ")
    else:
        return None 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:7,代码来源:app.py

示例4: opt_password

# 需要导入模块: from twisted.python import util [as 别名]
# 或者: from twisted.python.util import getPassword [as 别名]
def opt_password(self, password):
        """Required.  '-' will prompt or read a password from stdin.
        """
        # If standard input is a terminal, I prompt for a password and
        # confirm it.  Otherwise, I use the first line from standard
        # input, stripping off a trailing newline if there is one.
        if password in ('', '-'):
            self['password'] = util.getPassword(confirm=1)
        else:
            self['password'] = password 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:12,代码来源:manhole.py

示例5: reversePassword

# 需要导入模块: from twisted.python import util [as 别名]
# 或者: from twisted.python.util import getPassword [as 别名]
def reversePassword():
    password = util.getPassword()
    return reverseString(password) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:5,代码来源:test_util.py

示例6: testStdIn

# 需要导入模块: from twisted.python import util [as 别名]
# 或者: from twisted.python.util import getPassword [as 别名]
def testStdIn(self):
        """Making sure getPassword accepts a password from standard input.
        """
        from os import path
        import twisted
        # Fun path games because for my sub-process, 'import twisted'
        # doesn't always point to the package containing this test
        # module.
        script = """\
import sys
sys.path.insert(0, \"%(dir)s\")
from twisted.test import test_util
print test_util.util.__version__
print test_util.reversePassword()
""" % {'dir': path.dirname(path.dirname(twisted.__file__))}
        cmd_in, cmd_out, cmd_err = os.popen3("%(python)s -c '%(script)s'" %
                                             {'python': sys.executable,
                                              'script': script})
        cmd_in.write("secret\n")
        cmd_in.close()
        try:
            errors = cmd_err.read()
        except IOError, e:
            # XXX: Improper kludge to appease buildbot!  I'm not really sure
            # why this happens, and without that knowledge, I SHOULDN'T be
            # just catching and discarding this error.
            import errno
            if e.errno == errno.EINTR:
                errors = ''
            else:
                raise 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:33,代码来源:test_util.py


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