defgetWorkDates(startTime,endTime): days = list(rrule.rrule(rrule.DAILY,dtstart=parse(startTime),until=parse(endTime))) checkMouth = [] dayDatas = [] for day in days: dayDate = '%s%s%s'%(day.year,str(day.month).zfill(2),str(day.day).zfill(2)) mouth = '%s%s'%(day.year,str(day.month).zfill(2)) if mouth notin checkMouth: checkMouth.append(mouth) dayDatas.append(dayDate) checkMouth = ','.join(checkMouth) try: r = requests.get('http://www.easybots.cn/api/holiday.php?m='+checkMouth) d = json.loads(r.text) except: r = requests.get('http://www.easybots.cn/api/holiday.php?m=' + checkMouth) d = json.loads(r.text) checkDays = [] for data in d: for workDate in d[data]: checkDays.append('%s%s'%(data,workDate)) workDates = [date for date in dayDatas if date notin checkDays] return workDates