當前位置: 首頁>>代碼示例>>Python>>正文


Python Sanguo.compose_data方法代碼示例

本文整理匯總了Python中sanguo.Sanguo.compose_data方法的典型用法代碼示例。如果您正苦於以下問題:Python Sanguo.compose_data方法的具體用法?Python Sanguo.compose_data怎麽用?Python Sanguo.compose_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sanguo.Sanguo的用法示例。


在下文中一共展示了Sanguo.compose_data方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: do_weipai

# 需要導入模塊: from sanguo import Sanguo [as 別名]
# 或者: from sanguo.Sanguo import compose_data [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 compose_data [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: send_data

# 需要導入模塊: from sanguo import Sanguo [as 別名]
# 或者: from sanguo.Sanguo import compose_data [as 別名]
def send_data(dicdata, check_key=None):
    retry = 10
    t = 1
    while t <= retry:
        try:
            sanguo = Sanguo()
            sanguo.login()
            sanguo.login()
            data = sanguo.compose_data(dicdata)
            sanguo.tcpClientSock.send(data)
            res = sanguo.tcpClientSock.recv(4096)
            data = sanguo.decode(res)
            if check_key:
                if not data.has_key(check_key):
                    raise Exception()
            sanguo.close()
            if not data:
                raise Exception()
            return data
        except:
            #logger.error(traceback.format_exc())
            time.sleep(2)
            t += 1
開發者ID:,項目名稱:,代碼行數:25,代碼來源:


注:本文中的sanguo.Sanguo.compose_data方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。