當前位置: 首頁>>代碼示例>>Python>>正文


Python client.WarningPolicy方法代碼示例

本文整理匯總了Python中paramiko.client.WarningPolicy方法的典型用法代碼示例。如果您正苦於以下問題:Python client.WarningPolicy方法的具體用法?Python client.WarningPolicy怎麽用?Python client.WarningPolicy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在paramiko.client的用法示例。


在下文中一共展示了client.WarningPolicy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: ssh_signup

# 需要導入模塊: from paramiko import client [as 別名]
# 或者: from paramiko.client import WarningPolicy [as 別名]
def ssh_signup(user):
    # TODO: configure nodes used for authentication
    auth_node = next(iter(SSH.AVAILABLE_NODES))

    ssh_key = TensorHiveManager().dedicated_ssh_key
    test_client = SSHClient()
    test_client.load_system_host_keys()
    test_client.set_missing_host_key_policy(WarningPolicy())

    try:
        test_client.connect(auth_node, username=user['username'], pkey=ssh_key)
    except AuthenticationException:
        return {'msg': G['unpriviliged']}, 403
    except (BadHostKeyException, SSHException, socket.error) as e:
        return 'An error ocurred while authenticating: {}'.format(e), 500
    finally:
        test_client.close()

    return do_create(user) 
開發者ID:roscisz,項目名稱:TensorHive,代碼行數:21,代碼來源:create_user_controller.py

示例2: test_get_policy_dictionary

# 需要導入模塊: from paramiko import client [as 別名]
# 或者: from paramiko.client import WarningPolicy [as 別名]
def test_get_policy_dictionary(self):
        classes = [AutoAddPolicy, RejectPolicy, WarningPolicy]
        dic = get_policy_dictionary()
        for cls in classes:
            val = dic[cls.__name__.lower()]
            self.assertIs(cls, val) 
開發者ID:huashengdun,項目名稱:webssh,代碼行數:8,代碼來源:test_policy.py

示例3: test_get_policy_class

# 需要導入模塊: from paramiko import client [as 別名]
# 或者: from paramiko.client import WarningPolicy [as 別名]
def test_get_policy_class(self):
        keys = ['autoadd', 'reject', 'warning']
        vals = [AutoAddPolicy, RejectPolicy, WarningPolicy]
        for key, val in zip(keys, vals):
            cls = get_policy_class(key)
            self.assertIs(cls, val)

        key = 'non-exists'
        with self.assertRaises(ValueError):
            get_policy_class(key) 
開發者ID:huashengdun,項目名稱:webssh,代碼行數:12,代碼來源:test_policy.py


注:本文中的paramiko.client.WarningPolicy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。