fixed /newtransaction

This commit is contained in:
Linus E
2022-04-26 12:36:01 +02:00
parent b347c10653
commit 0c9cc0b4ef
2 changed files with 3 additions and 2 deletions

View File

@@ -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)