added crontab put function
This commit is contained in:
parent
99d39a0ed9
commit
27858a3b59
@ -263,7 +263,20 @@ class API_Handler:
|
|||||||
else:
|
else:
|
||||||
return self.get_user_portfolio(user_id, max_retries-1)
|
return self.get_user_portfolio(user_id, max_retries-1)
|
||||||
|
|
||||||
|
def set_cron_interval(self, user_id, cron_interval):
|
||||||
|
"""sets the cron interval of the user
|
||||||
|
|
||||||
|
Args:
|
||||||
|
user_id (int): id of the user
|
||||||
|
cron_interval (String): Update interval in cron format => see https://crontab.guru/ for formatting
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
int: status code
|
||||||
|
"""
|
||||||
|
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)
|
||||||
|
return req.status_code
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user