• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sanguo.Sanguo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: get_keji_info

 def get_keji_info(self):
     retry = 10
     t = 1
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.getKejiInfo()
             sanguo.close()
             if not data:
                 raise Exception()
             if not self.check_result(data):
                 raise Exception()
             return data
         except:
             time.sleep(2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:17,代码来源:KejiInfo.py


示例17: do_tax

 def do_tax(self):
     retry = 10
     t = 1 
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.tax()
             sanguo.close()
             if not data:
                 logger.error('Tax failed, data None')
                 raise Exception()
             logger.info('Tax succeed')
             return data
         except:
             logger.info('do_tax failed, will sleep %d seconds'%(t*2))
             time.sleep(t*2)
             t += 1
开发者ID:,项目名称:,代码行数:18,代码来源:


示例18: do_downgrade

 def do_downgrade(self, eid):
     retry = 10
     t = 1 
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.downgradeEquip(eid)
             sanguo.close()
             if not data:
                 logger.error('downgrade failed, data None')
                 raise Exception()
             #logger.info('downgrade succeed')
             return data
         except:
             logger.info('do_downgrade failed, will sleep %d seconds'%(t*2))
             time.sleep(t*2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:18,代码来源:downgradeEquip.py


示例19: do_soukuang

 def do_soukuang(self, pid):
     retry = 10
     t = 1
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.soukuang(pid)
             sanguo.close()
             if not data:
                 logger.error('soukuang %s failed.'%(pid))
                 raise Exception()
             logger.info('soukuang %s succeed. data len %d'%(pid, len(data)))
             return data
         except:
             logger.info('do_soukuang failed, will sleep %d seconds'%(t*2))
             time.sleep(t*2)
             t += 1
开发者ID:flaresky,项目名称:fengyunsanguo-plugin,代码行数:18,代码来源:soukuangThread.py


示例20: do_tufei

 def do_tufei(self, hero):
     retry = 10
     t = 1
     while t <= retry:
         try:
             sanguo = Sanguo()
             sanguo.login()
             data = sanguo.tufei(hero)
             sanguo.close()
             if not data:
                 logger.error('Tufei %s failed.'%(hero))
                 raise Exception()
             logger.info('tufei %s succeed'%(hero))
             return data
         except:
             t += 1
             logger.info('do_tufei failed, will sleep %d seconds'%(t*2))
             time.sleep(t*2)
开发者ID:,项目名称:,代码行数:18,代码来源:



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sanic.Sanic类代码示例发布时间:2022-05-27
下一篇:
Python sanetime.time函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap