def get_detail(beg=0): ctn = get_class('ctn') ses = get_session('ekomobile') ctn_list = ses.query(ctn).filter(ctn.operator_agree.in_([404, 405])).all() result_detail = [] null_phones = [] for phone in ctn_list[beg:]: try: api = Soap(ctn=phone.msisdn) dt = api.get_current_detail() except Exception: print("Последний - {}, {}".format(phone.msisdn, ctn_list.index(phone))) print(null_phones) return if len(dt) == 0: null_phones.append(phone.msisdn) result_detail.extend(dt) print("Ready {} of {}".format( ctn_list.index(phone) + 1, len(ctn_list))) print(null_phones) ex_write(values=result_detail, names=[ "Дата", "Исходящий", "Входящий", "Тип соединения", "Описание звонка", "Трафик", "Стоимость", "Длительность" ], path="/home/spicin/dt.xlsx")
def get_detail(beg=0): ctn = get_class("ctn") ses = get_session("ekomobile") ctn_list = ses.query(ctn).filter(ctn.operator_agree.in_([404, 405])).all() result_detail = [] null_phones = [] for phone in ctn_list[beg:]: try: api = Soap(ctn=phone.msisdn) dt = api.get_current_detail() except Exception: print("Последний - {}, {}".format(phone.msisdn, ctn_list.index(phone))) print(null_phones) return if len(dt) == 0: null_phones.append(phone.msisdn) result_detail.extend(dt) print("Ready {} of {}".format(ctn_list.index(phone) + 1, len(ctn_list))) print(null_phones) ex_write( values=result_detail, names=[ "Дата", "Исходящий", "Входящий", "Тип соединения", "Описание звонка", "Трафик", "Стоимость", "Длительность", ], path="/home/spicin/dt.xlsx", )
def get_as_info(): sapi = Soap(login="******", password="******") sapi.ban = sapi.get_ban_info()[0].ban print("get ban info") ctn_list = sapi.get_ctn_info(level="ban") print("get ctn list") write_list = [] for phone in ctn_list: write_list.append([str(phone.ctn[1:]), str(phone.status), str(phone.statusDate), str(phone.pricePlan)]) print("get {} of {}".format(ctn_list.index(phone) + 1, len(ctn_list))) ex_write( values=write_list, names=["msisdn", "status", "status_date", "price_plan", "price_plan_time"], path="/home/spicin/as.xlsx", )
def get_as_info(): sapi = Soap(login="******", password="******") sapi.ban = sapi.get_ban_info()[0].ban print('get ban info') ctn_list = sapi.get_ctn_info(level='ban') print('get ctn list') write_list = [] for phone in ctn_list: write_list.append([ str(phone.ctn[1:]), str(phone.status), str(phone.statusDate), str(phone.pricePlan) ]) print('get {} of {}'.format(ctn_list.index(phone) + 1, len(ctn_list))) ex_write(values=write_list, names=[ 'msisdn', 'status', 'status_date', 'price_plan', 'price_plan_time' ], path='/home/spicin/as.xlsx')