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


Python Log.exception方法代碼示例

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


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

示例1: change_ota

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import exception [as 別名]
def change_ota(hotel_id, ota_ids):
    Log.info("change ota>>hotel {}>>ota {}".format(hotel_id, ota_ids))
    url =  API['STOCK'] + '/stock/switch_ota'
    track_id = generate_track_id(hotel_id)
    if not ota_ids:
        ota_ids_str = '-1'
    else:
        ota_ids_str = '|'.join([str(id) for id in ota_ids])
    data = {
            'track_id': track_id,
            'chain_id': CHAIN_ID,
            'chain_hotel_id': hotel_id,
            'ota_ids': ota_ids_str,
            }
    body = urllib.urlencode(data)
    Log.info("change ota>>hotel {}>>ota {}:req {}".format(hotel_id, ota_ids, body))

    if not IS_PUSH_TO_STOCK:
        raise gen.Return(True)

    try:
        r = yield AsyncHTTPClient().fetch(url, method='POST', body=body)
        Log.info("change ota>>hotel {}>>ota {}:resp {}".format(hotel_id, ota_ids, r.body))
        resp = json.loads(r.body)
    except Exception, e:
        Log.exception(e)
        raise gen.Return(False)
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:29,代碼來源:ota.py

示例2: fetch_base_hotel_and_roomtypes

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import exception [as 別名]
 def fetch_base_hotel_and_roomtypes(self, hotel_id):
     url = API['POI'] + "/api/hotel/" + str(hotel_id) + "/roomtype/"
     try:
         r = yield AsyncHTTPClient().fetch(url)
         result = json.loads(r.body)
     except Exception, e:
         Log.exception(e)
         raise gen.Return((None, None))
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:10,代碼來源:hotel.py

示例3: post_hotel

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import exception [as 別名]
 def post_hotel(self, hotel_data):
     Log.info(u"<<POI push hotel mapping>> push request {}".format(hotel_data))
     url = API['POI'] + '/api/push/ebooking/hotel/'
     body = json.dumps(hotel_data)
     try:
         r = yield AsyncHTTPClient().fetch(url, method='POST', headers={"Content-Type": "application/json"}, body=body)
         Log.info("<<POI push hotel mapping>> response {}".format(r.body))
         resp = json.loads(r.body)
     except Exception, e:
         Log.exception(e)
         raise gen.Return(False)
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:13,代碼來源:poi.py

示例4: post_room

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import exception [as 別名]
 def post_room(self, room_data):
     Log.info(u"<<POI push roomtype mapping>> push request {}".format(room_data))
     url = API['POI'] + '/api/push/ebooking/room/'
     body = json.dumps(room_data)
     if not IS_PUSH_TO_POI:
         raise gen.Return(True)
     try:
         r = yield AsyncHTTPClient().fetch(url, method='POST', headers={"Content-Type": "application/json"}, body=body)
         Log.info("<<POI push roomtype mapping>> response {}".format(r.body))
         resp = json.loads(r.body)
     except Exception, e:
         Log.exception(e)
         raise gen.Return(False)
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:15,代碼來源:poi.py

示例5: call_weixin

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import exception [as 別名]
 def call_weixin(self, order):
     if order.confirm_type == OrderModel.CONFIRM_TYPE_AUTO:
         raise gen.Return()
     map_hotels = UserHotelMappingModel.get_hotel_by_id(self.db, merchant_id=order.merchant_id,
                                                       hotel_id=order.hotel_id)
     order_dict = order.todict()
     if map_hotels:
         user_ids = [map_hotel.user_id for map_hotel in map_hotels]
         users = UserModel.get_users_by_id(self.db, user_ids)
         usernames = [user.username for user in users]
         order_dict['usernames'] = ",".join(usernames)
     url = API['WEIXIN'] + "/webchart/ebkOrderPush"
     body = urllib.urlencode(order_dict)
     try:
         yield AsyncHTTPClient().fetch(url, method='POST', body=body)
     except Exception, e:
         Log.exception(e)
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:19,代碼來源:submit_order.py

示例6: post_hotels

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import exception [as 別名]
    def post_hotels(self, hotel_datas):
        hotel_ids = [hotel_data['id'] for hotel_data in hotel_datas]
        track_id = self.generate_track_id(id(hotel_ids))
        data = {'list': hotel_datas}
        params = {'track_id': track_id, 'data': json.dumps(data)}
        Log.info(u"<<push hotels {}>> push data {}".format(hotel_ids, params))
        url = API['STOCK'] + '/stock/update_hotel?is_async=false'

        body = urllib.urlencode(params)

        if not IS_PUSH_TO_STOCK:
            raise gen.Return(True)

        try:
            r = yield AsyncHTTPClient().fetch(url, method='POST', body=body)
            resp = json.loads(r.body)
        except Exception, e:
            Log.exception(e)
            raise gen.Return(False)
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:21,代碼來源:hotel.py

示例7: update_rateplans_valid_status

# 需要導入模塊: from tools.log import Log [as 別名]
# 或者: from tools.log.Log import exception [as 別名]
    def update_rateplans_valid_status(self, rateplan_ids):
        Log.info("<< push rateplans {} update rateplan valid>>".format(rateplan_ids))
        if not IS_PUSH_TO_STOCK:
            raise gen.Return(True)

        rateplans = RatePlanModel.get_by_ids(self.db, rateplan_ids, with_delete=True)
        rateplan_datas = [{"chain_id": CHAIN_ID, "hotel_id": rateplan.hotel_id, "rate_plan_id": rateplan.id, "is_valid": self.cal_rateplan_isvalid(rateplan)} for rateplan in rateplans]

        track_id = self.generate_track_id(rateplan_ids)
        data = {'list': rateplan_datas, 'type': 3}
        params = {'track_id': track_id, 'data': json.dumps(data)}
        body = urllib.urlencode(params)
        url = API['STOCK'] + '/stock/update_state?is_async=false'

        Log.info("<< push rateplan {} update rateplan valid request {}>>".format(rateplan_ids, params))
        try:
            r = yield AsyncHTTPClient().fetch(url, method='POST', body=body)
            Log.info("<< push rateplan {} update rateplan valid response {}>>".format(rateplan_ids, r.body))
            resp = json.loads(r.body)
        except Exception, e:
            Log.exception(e)
            raise gen.Return(False)
開發者ID:icyCloud,項目名稱:test_e_b_k,代碼行數:24,代碼來源:rateplan.py


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