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


Python Client.close方法代码示例

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


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

示例1: getindex

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import close [as 别名]
 def getindex(self):
     try:
         num = int(self._input('Peer Num : '))
         peer = self.vpn.get_peer_by_num(num)
         clt = Client(self.vpn)
         print "[+] Connecting to %s at %s:%d ... [Ctrl+c]" % (peer[1], peer[2], peer[3])
         clt.connect(peer[2], peer[3], (peer[4],peer[5]))
         print "[+] Connected"
         print "[+] Get Index ..."
         clt.get_index(peer[0])
         clt.close()
     except Exception as e:
         print "[Error]", e
     except KeyboardInterrupt:
         print "[!] Connection close"
     else:
         print "[+] Index downloaded"
开发者ID:sok63,项目名称:vpyn,代码行数:19,代码来源:VPyN.py

示例2: downloadfile

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import close [as 别名]
 def downloadfile(self):
     try:
         num = int(self._input('Peer Num : '))
         peer = self.vpn.get_peer_by_num(num)
         idfile = int(self._input('File ID : '))
         name = Index(peer[0]).get_file_by_id(idfile)[1]
         clt = Client(self.vpn)
         print "[+] Connecting to %s at %s:%d ... [Ctrl+c]" % (peer[1], peer[2], peer[3])
         clt.connect(peer[2], peer[3], (peer[4],peer[5]))
         print "[+] Connected"
         print '[+] Get File "%s" ...' % name
         clt.get_file(idfile, name)
         clt.close()
     except Exception as e:
         print "[Error]", e
     except KeyboardInterrupt:
         print "[!] Connection close"
     else:
         print "[+] File downloaded"
开发者ID:sok63,项目名称:vpyn,代码行数:21,代码来源:VPyN.py

示例3: Client

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import close [as 别名]
from Client import Client
import os

if __name__ == '__main__':
    c = Client()
    while c.work:
        pass

    # user clicked exit button
    c.close()
    # 1 --> SIGHUP
    os.kill(os.getppid(),1)
开发者ID:leanhd,项目名称:tamchy,代码行数:14,代码来源:tamchy.py

示例4: execute_command

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import close [as 别名]
def execute_command(command, host):
    client =  Client(host['ip'], host['user'], host['password'] )
    status, stdOut = client.command(command)
    client.close()
    return {"status_code" : status, "standard_out" : stdOut }
开发者ID:Grofao,项目名称:Scripts,代码行数:7,代码来源:Service.py

示例5: run_on_all

# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import close [as 别名]
def run_on_all(args, operation):
    for ip_address in args.ip_address:
        client = Client(ip_address, args.user, args.password)
        operation(args, client)
        client.close()
开发者ID:Grofao,项目名称:Scripts,代码行数:7,代码来源:PyShell.py


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