bot new commands and funcs + api updates
This commit is contained in:
@@ -12,6 +12,7 @@ __license__ = "None"
|
||||
import sys
|
||||
import os
|
||||
import requests as r
|
||||
from croniter import croniter
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +33,6 @@ class API_Handler:
|
||||
delete_share(user_id, symbol): deletes the share of the user
|
||||
get_user_transactions(user_id): gets the transactions of the user
|
||||
set_transaction(user_id, transaction): sets the transaction of the user
|
||||
delete_transaction(user_id, transaction): deletes the transaction of the user
|
||||
get_user_portfolio(user_id): gets the portfolio of the user
|
||||
set_portfolio(user_id, portfolio): sets the portfolio of the user
|
||||
delete_portfolio(user_id, portfolio): deletes the portfolio of the user
|
||||
@@ -322,6 +322,10 @@ class API_Handler:
|
||||
Returns:
|
||||
int: status code
|
||||
"""
|
||||
if not croniter.is_valid(cron_interval):
|
||||
print("Error: Invalid cron format")
|
||||
return -1
|
||||
|
||||
with r.Session() as s:
|
||||
headers = {'Authorization': 'Bearer ' + self.token + ":" + str(user_id)}
|
||||
req = s.put(self.db_adress + "/user/setCron", json={"cron": cron_interval}, headers=headers)
|
||||
|
Reference in New Issue
Block a user