MCPcopy Create free account
hub / github.com/cxapython/catvm / make_date

Function make_date

selenium/shannon_spider/util/datetime_util.py:109–133  ·  view source on GitHub ↗
(start_time)

Source from the content-addressed store, hash-verified

107
108
109def make_date(start_time):
110 # 够造请求日期(需将2006-10-8至现在所有数据爬取)
111 # 请求数据日期规格只能为一年,即2006-10-08至2007-10-07
112 # start_time = '2006-10-08'
113 # return [{'start_time': '2006-10-08', 'end_time': '2007-10-07'}.....]
114 date_list = []
115 start_time = start_time
116 end_time = date_add_year(str_time=start_time, layout='%Y-%m-%d')
117 while 1:
118 if not date_compare(end_time):
119 end_time = get_now_time(layout='%Y-%m-%d')
120 item = {
121 'start_time': date_list[-1]['end_time'],
122 'end_time': end_time
123 }
124 date_list.append(item)
125 break
126 item = {
127 'start_time': start_time,
128 'end_time': end_time
129 }
130 date_list.append(item)
131 start_time = item['end_time']
132 end_time = date_add_year(str_time=start_time, layout='%Y-%m-%d')
133 return date_list
134
135
136def make_date_for_month_dict(start_time):

Callers

nothing calls this directly

Calls 3

date_add_yearFunction · 0.85
date_compareFunction · 0.85
get_now_timeFunction · 0.85

Tested by

no test coverage detected