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


Python Sanguo.close方法代码示例

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


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

示例1: do_weipai

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def do_weipai(self, tpe, level):
     dicdata = {
             'level' : str(level),
             'op' : 1021,
             'type' : str(tpe),
         }
     retry = 10
     t = 1
     while t <= retry:
         try:
             res = ''
             sanguo = Sanguo()
             sanguo.login()
             sanguo.login()
             data = sanguo.compose_data(dicdata)
             sanguo.tcpClientSock.send(data)
             #res += sanguo.tcpClientSock.recv(1024)
             time.sleep(2)
             res += sanguo.tcpClientSock.recv(4096)
             if len(res) < 5:
                 raise Exception()
             data = util.decode_data(res)
             if not data or len(data) < 1:
                 logger.error('no data')
                 raise Exception()
             sanguo.close()
             if not data[0].has_key('exception'):
                 self.add_cost(tpe, level)
             return data
         except:
             #logger.error(traceback.format_exc())
             time.sleep(2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:35,代码来源:pifeng.py

示例2: get_pozen_info

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def get_pozen_info(self, campaignid):
     dicdata = {
             'op' : 3001,
             'campaignId' : int(campaignid)
         }
     retry = 10
     t = 1
     while t <= retry:
         try:
             res = ''
             sanguo = Sanguo()
             sanguo.login()
             sanguo.login()
             data = sanguo.compose_data(dicdata)
             sanguo.tcpClientSock.send(data)
             time.sleep(2)
             res += sanguo.tcpClientSock.recv(4096)
             if len(res) < 5:
                 raise Exception()
             data = util.decode_data(res)
             if not data or len(data) < 1:
                 logger.error('no data')
                 raise Exception()
             sanguo.close()
             return data[1]['armys']
         except:
             time.sleep(2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:30,代码来源:pozenThread.py

示例3: do_zengzan

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def do_zengzan(self, nstr):
     retry = 10
     t = 1 
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.zengzan(nstr)
             sanguo.close()
             if not data:
                 raise Exception()
             return data
         except:
             logger.info('do_zengzan failed, will sleep 2 seconds')
             time.sleep(2)
             t += 1
开发者ID:,项目名称:,代码行数:18,代码来源:

示例4: suaxin_husong_list

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def suaxin_husong_list(self):
     retry = 10
     t = 1
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.husong_suaxin()
             sanguo.close()
             if not data:
                 raise Exception()
             return data
         except:
             logger.info('husong_suaxin failed, will sleep %d seconds'%(t*2))
             time.sleep(t*2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:18,代码来源:lanjieThread.py

示例5: do_upgrade

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def do_upgrade(self, eid, magic, buymagic=0):
     retry = 10
     t = 1 
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.upgradeEquip(eid, magic, buymagic)
             sanguo.close()
             if not data:
                 raise Exception()
             logger.info('Upgrade %s succeed'%(eid))
             return data
         except:
             time.sleep(2)
             t += 1
开发者ID:,项目名称:,代码行数:18,代码来源:

示例6: tongsang

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
def tongsang(uname):
    retry = 10
    t = 1
    while t <= retry:
        try:
            sanguo = Sanguo()
            sanguo.login()
            data = sanguo.tongsang(uname)
            sanguo.close()
            if not data:
                raise Exception()
            logger.info("Tongsang %s succeed." % (uname))
            return data
        except:
            time.sleep(3)
            t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:18,代码来源:tongsang.py

示例7: get_user

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
def get_user(uid):
    retry = 10
    t = 1
    while t <= retry:
        try:
            sanguo = Sanguo()
            sanguo.login()
            data = sanguo.getUserInfo(uid)
            sanguo.close()
            if not data:
                raise Exception()
            else:
                return data
        except:
            time.sleep(2)
            t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:18,代码来源:getUserInfo.py

示例8: get_equip_info

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def get_equip_info(self):
     retry = 10
     t = 1
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.get_equip_info()
             sanguo.close()
             if not data:
                 raise Exception()
             else:
                 return data
         except:
             time.sleep(2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:18,代码来源:MagicInfo.py

示例9: bianzhen

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def bianzhen(self, keji):
     retry = 10
     t = 1 
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.bianzhen(keji)
             sanguo.close()
             if not data:
                 logger.error('bianzhen failed, data None')
                 raise Exception()
             return data
         except:
             logger.info('bianzhen failed, will sleep %d seconds'%(t*2))
             time.sleep(t*2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:19,代码来源:pozenThread.py

示例10: sell_baowu

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
def sell_baowu(bid):
    retry = 10
    t = 1
    while t <= retry:
        try:
            sanguo = Sanguo()
            sanguo.login()
            data = sanguo.sell_baowu(bid)
            sanguo.close()
            if not data:
                raise Exception()
            logger.info("sell baowu %s succeed"%(str(bid)))
            return data
        except:
            #logger.error("sell baowu %s failed"%(str(bid)))
            time.sleep(2)
            t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:19,代码来源:sellBaowu.py

示例11: do_ttt

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def do_ttt(self):
     retry = 10
     t = 1 
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.tongtianta()
             sanguo.close()
             if not data:
                 logger.error('ttt failed, data None')
                 raise Exception()
             logger.info('tongtianta succeed, result %d'%(data['result']))
             return data
         except:
             logger.info('do_ttt failed, will sleep %d seconds'%(t*2))
             time.sleep(t*2)
开发者ID:,项目名称:,代码行数:19,代码来源:

示例12: send_command

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
def send_command(cmd, *args):
    retry = 10
    t = 1
    while t <= retry:
        try:
            sanguo = Sanguo()
            sanguo.login()
            function = getattr(sanguo, cmd)
            res = function(*args)
            sanguo.close()
            if res == None:
                raise Exception()
            return res
        except:
            #logger.error(cmd + "\n" + traceback.format_exc())
            time.sleep(2*t)
            t += 1
开发者ID:,项目名称:,代码行数:19,代码来源:

示例13: get_user

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
def get_user(uid):
    retry = 10
    t = 1
    while t <= retry:
        try:
            sanguo = Sanguo()
            sanguo.login()
            data = sanguo.getUserInfo(uid)
            sanguo.close()
            if not data:
                raise Exception()
            if not data.has_key('protectTime'):
                raise Exception('No protectTime')
            return data
        except:
            time.sleep(2 * t)
            t += 1
开发者ID:,项目名称:,代码行数:19,代码来源:

示例14: sync_time

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
def sync_time():
    retry = 10
    t = 1
    while t <= retry:
        try:
            sanguo = Sanguo()
            stime = sanguo.login()
            if not stime:
                raise Exception()
            ltime = int(time.time())
            sanguo.close()
            Server_Time = stime
            Local_Server_Diff = ltime - stime
            return (Server_Time, Local_Server_Diff)
        except:
            time.sleep(2)
            t += 1
开发者ID:,项目名称:,代码行数:19,代码来源:

示例15: get_city_info

# 需要导入模块: from sanguo import Sanguo [as 别名]
# 或者: from sanguo.Sanguo import close [as 别名]
 def get_city_info(self, cityid, zoneid):
     retry = 10
     t = 1
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.getCityInfo(cityid, zoneid)
             sanguo.close()
             if not data:
                 logger.error('get_city_info failed')
                 raise Exception()
             else:
                 return data
         except:
             time.sleep(2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:19,代码来源:cityThread.py


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