timedelta import

main
Bob Mottram 2020-11-22 15:33:11 +00:00
parent b58cdeba8b
commit c937cbdac8
1 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import requests
from socket import error as SocketError from socket import error as SocketError
import errno import errno
from datetime import datetime from datetime import datetime
from datetime import timedelta
from collections import OrderedDict from collections import OrderedDict
from utils import firstParagraphFromString from utils import firstParagraphFromString
from utils import isPublicPost from utils import isPublicPost
@ -208,7 +209,7 @@ def xml2StrToDict(baseDir: str, domain: str, xmlStr: str,
try: try:
publishedDate = \ publishedDate = \
datetime.strptime(pubDate, "%a, %d %b %Y %H:%M:%S EST") datetime.strptime(pubDate, "%a, %d %b %Y %H:%M:%S EST")
hoursAdded = datetime.timedelta(hours=5) hoursAdded = timedelta(hours=5)
publishedDate = publishedDate + hoursAdded publishedDate = publishedDate + hoursAdded
postFilename = '' postFilename = ''
votesStatus = [] votesStatus = []
@ -341,7 +342,7 @@ def atomFeedToDict(baseDir: str, domain: str, xmlStr: str,
try: try:
publishedDate = \ publishedDate = \
datetime.strptime(pubDate, "%a, %d %b %Y %H:%M:%S EST") datetime.strptime(pubDate, "%a, %d %b %Y %H:%M:%S EST")
hoursAdded = datetime.timedelta(hours=5) hoursAdded = timedelta(hours=5)
publishedDate = publishedDate + hoursAdded publishedDate = publishedDate + hoursAdded
postFilename = '' postFilename = ''
votesStatus = [] votesStatus = []