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


Python sanguo.Sanguo类代码示例

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


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

示例1: sync_time

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:,项目名称:,代码行数:17,代码来源:

示例2: send_command

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:,项目名称:,代码行数:17,代码来源:

示例3: get_pozen_info

 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,代码行数:28,代码来源:pozenThread.py

示例4: do_weipai

 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,代码行数:33,代码来源:pifeng.py

示例5: tongsang

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,代码行数:16,代码来源:tongsang.py

示例6: suaxin_husong_list

 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,代码行数:16,代码来源:lanjieThread.py

示例7: get_equip_info

 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,代码行数:16,代码来源:MagicInfo.py

示例8: do_zengzan

 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:,项目名称:,代码行数:16,代码来源:

示例9: do_upgrade

 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:,项目名称:,代码行数:16,代码来源:

示例10: get_user

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,代码行数:16,代码来源:getUserInfo.py

示例11: do_ttt

 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:,项目名称:,代码行数:17,代码来源:

示例12: sell_baowu

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,代码行数:17,代码来源:sellBaowu.py

示例13: bianzhen

 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,代码行数:17,代码来源:pozenThread.py

示例14: get_user

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:,项目名称:,代码行数:17,代码来源:

示例15: get_city_info

 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,代码行数:17,代码来源:cityThread.py


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