當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。