Skip to content

Commit

Permalink
Merge pull request TotalAwesome#6 from lvu22292718/main
Browse files Browse the repository at this point in the history
Refresh token
  • Loading branch information
TotalAwesome authored Jul 17, 2024
2 parents 109f190 + 7e3ebb4 commit 24921e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions bots/tapcoins/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
from bots.tapcoins.strings import HEADERS, URL_INIT, URL_LOGIN, URL_CARDS_CATEGORIES, URL_CARDS_LIST, \
URL_CARDS_UPGRADE, URL_LUCKY_BOUNTY, MSG_NO_CARDS_TO_UPGRADE, \
MSG_CARD_UPGRADED, MSG_NOT_ENOUGH_COINS, MSG_CARD_UPGRADED_COMBO, URL_DAILY, URL_DAILY_COMPLETE, \
MSG_LOGIN_BONUS_COMPLETE, URL_USER_INFO, MSG_UPGRADING_CARDS, MSG_UPGRADE_COMPLETE, MSG_MAX_UPGRADES_REACHED
MSG_LOGIN_BONUS_COMPLETE, URL_USER_INFO, MSG_UPGRADING_CARDS, MSG_UPGRADE_COMPLETE, MSG_MAX_UPGRADES_REACHED, \
URL_REFRESH

DEFAULT_EST_TIME = 60 * 45
DEFAULT_EST_TIME = 60 * 10


class BotFarmer(BaseFarmer):
Expand Down Expand Up @@ -183,18 +184,35 @@ def daily_bonus(self):
def get_hour_earnings(self):

response = self.post(URL_USER_INFO, {'_token': self.token})

if response.status_code == 401:
self.authenticate()
response = self.post(URL_USER_INFO, {'_token': self.token})

data = response.json()['data']

self.hours_earnings = data['hour_earnings']

def get_balance(self):

response = self.post(URL_USER_INFO, {'_token': self.token})

if response.status_code == 401:
self.authenticate()
response = self.post(URL_USER_INFO, {'_token': self.token})

data = response.json()['data']

self.balance = data['balance']

def refresh(self):
response = self.post(URL_REFRESH, {'_token': self.token})

if response.status_code != 200:
self.authenticate()

def farm(self):
self.refresh()
self.get_balance()
self.daily_bonus()
self.get_bounty()
Expand Down
1 change: 1 addition & 0 deletions bots/tapcoins/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
URL_CARDS_UPGRADE = 'https://api.tapcoins.app/mine/upgrade'
URL_LUCKY_BOUNTY = 'https://api.tapcoins.app/mine/lucky'
URL_USER_INFO = 'https://api.tapcoins.app/mine/mine'
URL_REFRESH = 'https://api.tapcoins.app/user/online/refresh'

HEADERS = {
'Accept': 'application/json, text/plain, */*',
Expand Down

0 comments on commit 24921e6

Please sign in to comment.