def __init__(self,phoneFile,coupon_info,threadNum=1,startTime='08:30:00',endTime='20:30:00'):
     self.reqSes = requests.session()
     self.startSendTime = startTime
     self.endSendTime = endTime
     self.threadNum = threadNum
     self.reqSes.keep_alive=False
     self.reqSes.adapters.DEFAULT_RETRIES = 5
     self.phone_file=phoneFile
     self.actName = coupon_info['actName']
     self.prov_code = coupon_info['prov_code']
     self.channelId = coupon_info['channelId']
     self.batchIDs = coupon_info['batchID']
     self.phone_que =Queue.Queue()
     self.logger =printLog.getLogger(getDate.getTime(),"send",config.log_dir)
     self.failedLogger =printLog.getLogger(getDate.getTime(),"unsend",config.log_dir)
Exemple #2
0
#coding:utf8

import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import getDate, printLog, createPath
from conf import config
import sendmessage
import time
loggerTime = getDate.getTime()
today = getDate.getToday()
log_dir = createPath.mkdir(config.log_dir)
phone_dir = createPath.mkdir(config.data_dir + '/duanxin')
logger = printLog.getLogger(loggerTime, 'duanxin', log_dir)

messageFile = config.conf_dir + '/message.conf'
resultFile = '%s/sent_%s.txt' % (phone_dir, loggerTime)
failedFile = '%s/unsend_%s.txt' % (phone_dir, loggerTime)


def getData():
    '''
    读取号码文件
    :param batch_phone_file:
    :return:
    '''
    files = os.popen('ls %s/*%s.dat' % (phone_dir, today))
    filelist = files.readlines()
Exemple #3
0
#coding:utf8

import os
import time
import sys, threading
#########
#python2 需要对编码进行处理
reload(sys)
sys.setdefaultencoding('utf8')
###########
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
sys.dont_write_bytecode = True
from Utils import dbOper, printLog, getDate
from conf import config
loggerDate = getDate.getTime()
logger = printLog.getLogger(loggerDate, "kaquan", "%s/kaquan/log/" % BASE_DIR)


def getConnect():
    try:
        return config.kqzx2_0_1, config.kqzx2_0_2

    except Exception as e:
        return None, None


class kaQ(object):
    def __init__(self):
        self.count = 0
        self.connect_info = getConnect()