本文整理汇总了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)
示例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))
示例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)
示例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)
示例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)
示例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)
示例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)