diff options
Diffstat (limited to 'jb/managers/thl.py')
| -rw-r--r-- | jb/managers/thl.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/jb/managers/thl.py b/jb/managers/thl.py index e50fe76..85e0697 100644 --- a/jb/managers/thl.py +++ b/jb/managers/thl.py @@ -1,25 +1,18 @@ +import requests +from generalresearch.currency import USDCent +from generalresearch.models.thl.definitions import PayoutStatus from generalresearch.models.thl.payout import UserPayoutEvent from generalresearch.models.thl.task_status import TaskStatusResponse from generalresearch.models.thl.wallet.cashout_method import ( - CashoutRequestResponse, CashoutRequestInfo, + CashoutRequestResponse, ) -from generalresearch.models.thl.user_profile import UserProfile -from generalresearch.currency import USDCent - from jb.config import settings - -from generalresearch.models.thl.definitions import PayoutStatus - - -from typing import Optional -import requests - from jb.models.auth import User -def get_task_status(tsid: str) -> Optional[TaskStatusResponse]: +def get_task_status(tsid: str) -> TaskStatusResponse | None: url = f"{settings.fsb_host}{settings.product_id}/status/{tsid}/" d = requests.get(url).json() if d.get("msg") == "invalid tsid": @@ -67,7 +60,7 @@ def get_wallet_balance(amt_worker_id: str) -> USDCent: return USDCent(requests.get(url, params=params).json()["wallet"]["amount"]) -def get_wallet_balance_if_non_negative(amt_worker_id: str) -> Optional[USDCent]: +def get_wallet_balance_if_non_negative(amt_worker_id: str) -> USDCent | None: url = f"{settings.fsb_host}{settings.product_id}/wallet/" params = {"bpuid": amt_worker_id} amt = requests.get(url, params=params).json()["wallet"]["amount"] |
