File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ def log(line):
5353 else :
5454 log_data += line + "\n "
5555
56+ # python before 2.7 doesn't have the total_seconds method on datetime.timedelta.
57+ def total_seconds (td ):
58+ return (td .microseconds + (td .seconds + td .days * 24 * 3600 ) * 10 ** 6 ) / 10 ** 6
59+
5660def parse (response ):
5761 def getChildText (parentNode , tagName ):
5862 for node in parentNode .childNodes :
@@ -262,7 +266,7 @@ def insert_to_databaseREDESIGN(data):
262266 if abs (pubdate - synthesized ) > timedelta (days = 60 ):
263267 synthesized = pubdate
264268 else :
265- direction = - 1 if (pubdate - synthesized ). total_seconds ( ) < 0 else + 1
269+ direction = - 1 if total_seconds (pubdate - synthesized ) < 0 else + 1
266270 while synthesized .month != pubdate .month or synthesized .year != pubdate .year :
267271 synthesized += timedelta (days = direction )
268272 e .time = synthesized
You can’t perform that action at this time.
0 commit comments