implemented /removeshare

This commit is contained in:
Linus E
2022-05-10 08:57:56 +02:00
parent 79870ecb1c
commit 8a08f9a26e
2 changed files with 34 additions and 4 deletions

View File

@@ -223,7 +223,7 @@ class API_Handler:
Args:
user_id (int): id of the user
isin (string): isin of the share
isin (string): identifier of the share (standard is isin)
comment (string): comment of the share
Returns:
@@ -240,14 +240,14 @@ class API_Handler:
Args:
user_id (int): id of the user
symbol (string): symbol of the share
isin (string): identifier of the share (standard is isin)
Returns:
int: status code
"""
with r.Session() as s:
headers = {'Authorization': 'Bearer ' + self.token + ":" + str(user_id)}
req = s.delete(self.db_adress + "/share", json={"isin": isin}, headers=headers) # to delete a share only the isin is needed because it is unique, shares are not transactions!
req = s.delete(self.db_adress + "/share", json={"isin": str(isin)}, headers=headers) # to delete a share only the isin is needed because it is unique, shares are not transactions!
return req.status_code