#-*- coding: utf-8 -*-
#all decorators in this tool file
#author: orangleliu
############################################################
#http连接有问题时候,自动重连
def conn_try_again(function):
RETRIES = 0
#重试的次数
count = {"num": RETRIES}
def wrapped(*args, **kwargs):
try:
return function(*args, **kwargs)
except Exception, err:
if count['num'] < 2:
count['num'] += 1
return wrapped(*args, **kwargs)
else:
raise Exception(err)
return wrapped
@conn_try_again
def post_query_bandwidth_for_bandwidth(self, contract_no, data_month, product_code):
#根据webluker接口情况获取计费数据
try:
post_data = {'contract':contract_no, 'month': data_month, 'code':product_code}
params = urllib.urlencode(post_data)
response = urllib2.urlopen(WEBLUKER_BANDWITH_API + "?" +params)
billdata = {}
billdata = response.read()
if not billdata:
billdata = {}
return billdata
except Exception, err:
err = u'与webluker接口间通信异常'
raise Exception(err)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有