diff --git a/datetime.json b/datetime.json index e311f4a..aa8d765 100644 --- a/datetime.json +++ b/datetime.json @@ -1 +1 @@ -"2022-06-03 08:02:08.563110" \ No newline at end of file +"2022-06-06 18:23:00.7168350" diff --git a/main.py b/main.py index ce072c0..f170a12 100644 --- a/main.py +++ b/main.py @@ -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__':