本文整理汇总了Python中API.sta_set_security方法的典型用法代码示例。如果您正苦于以下问题:Python API.sta_set_security方法的具体用法?Python API.sta_set_security怎么用?Python API.sta_set_security使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API.sta_set_security方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: connect_to_open_none
# 需要导入模块: import API [as 别名]
# 或者: from API import sta_set_security [as 别名]
def connect_to_open_none():
# add_network
network_id = API.sta_add_network()
# set network_id(ssid:test)
set_network = Dictionary.network_variable.copy()
set_network["ssid"] = '"Roaming_Test"'
API.sta_set_network(network_id, set_network)
time.sleep(2)
# set network_id(auth_alg:OPEN/key_mgmt:NONE)
set_security = Dictionary.security_config.copy()
set_security["auth_alg"] = 'OPEN'
set_security["key_mgmt"] = 'NONE'
API.sta_set_security(network_id, set_security)
time.sleep(2)
# connect to AP
result = API.sta_associate(network_id, 60)
API.sta_remove_network(network_id)
print 'Connect Result: %s' % result
return result
示例2: connect_to_wpa2_psk_tkip
# 需要导入模块: import API [as 别名]
# 或者: from API import sta_set_security [as 别名]
def connect_to_wpa2_psk_tkip():
# add network
network_id = API.sta_add_network()
# set network variable
set_network = Dictionary.network_variable.copy()
set_network["ssid"] = '"Roaming_Test"'
set_network["scan_ssid"] = "1"
API.sta_set_network(network_id, set_network)
# set security config
set_security = Dictionary.security_config.copy()
set_security["auth_alg"] = "OPEN"
set_security["proto"] = "RSN"
set_security["key_mgmt"] = "WPA-PSK"
set_security["pairwise"] = "TKIP"
set_security["psk"] = '"12345678"'
API.sta_set_security(network_id, set_security)
# set over connect to AP
result = API.sta_associate(network_id, 30)
print 'Connect Result: %s' % result
return True