fix work with datetime

This commit is contained in:
Антон Скалкин 2022-06-06 19:52:58 +04:00 committed by anton
parent ae99192765
commit d36d46d409
2 changed files with 6 additions and 4 deletions

View File

@ -1 +1 @@
"2022-06-03 08:02:08.563110"
"2022-06-06 18:23:00.7168350"

View File

@ -20,8 +20,8 @@ def main():
date = json.load(json_file)
cursor = cnxn.cursor()
cursor.execute("SELECT Id, Title, Body FROM Newses "
"WHERE Newses.IsDeleted = 0 AND Newses.DateCreate >= ? "
cursor.execute("SELECT Id, Title, Body, DateCreate FROM Newses "
"WHERE Newses.IsDeleted = 0 AND Newses.DateCreate > ? "
"ORDER BY Newses.DateCreate", date) # например - 2022-04-02 11:19:29.778400
row = cursor.fetchone()
@ -32,10 +32,12 @@ def main():
'text': f'{row[1]}\n{textNews}\nhttp://is.ulstu.ru/News/ShowNews/{row[0]}'}
requests.get('https://api.telegram.org/bot5567223643:AAG6DYNUNq7BNqm7-pI2p-SdvEmAKielViE/sendMessage',
params=params)
date = row[3]
row = cursor.fetchone()
with open('datetime.json', 'w') as outfile:
json.dump(str(datetime.now()), outfile)
json.dump(str(date), outfile)
if __name__ == '__main__':