From 0c9cc0b4ef3288183252a6dec52554e64891b11c Mon Sep 17 00:00:00 2001 From: Linus E <75929322+Rripped@users.noreply.github.com> Date: Tue, 26 Apr 2022 12:36:01 +0200 Subject: [PATCH] fixed /newtransaction --- telegram_bot/api_handling/api_handler.py | 1 + telegram_bot/bot.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/telegram_bot/api_handling/api_handler.py b/telegram_bot/api_handling/api_handler.py index 63cfcdf..51e0ca1 100644 --- a/telegram_bot/api_handling/api_handler.py +++ b/telegram_bot/api_handling/api_handler.py @@ -288,6 +288,7 @@ class API_Handler: int: status code """ with r.Session() as s: + time = time[:-3] + "Z" # remove last character and add Z to make it a valid date for db headers = {'Authorization': 'Bearer ' + self.token + ":" + str(user_id)} transaction = {"comment": str(comment), "count": float(count), "isin": str(isin), "price": float(price), "time": str(time)} # set transaction as JSON with all the attributes needed according to Swagger docs req = s.post(self.db_adress + "/transaction", json=transaction, headers=headers) diff --git a/telegram_bot/bot.py b/telegram_bot/bot.py index 331b29d..90f1866 100644 --- a/telegram_bot/bot.py +++ b/telegram_bot/bot.py @@ -483,8 +483,8 @@ def set_new_transaction_step(message): amount = float(transaction_data[2]) price = float(transaction_data[3]) time = dt.datetime.now().isoformat() - #print("\n\n\n\n\n") - #print(f"{symbol},{amount},{price},{time}") + print("\n\n\n\n\n") + print(f"{isin},{amount},{price},{time}") status = api_handler.set_transaction(user_id, desc, isin, amount, price, time) if status == 200: