Skip to content

Instantly share code, notes, and snippets.

@cookie223
Last active June 2, 2024 12:44
Show Gist options
  • Save cookie223/c154bbe7b93a1a8afc05b92d17044427 to your computer and use it in GitHub Desktop.
Save cookie223/c154bbe7b93a1a8afc05b92d17044427 to your computer and use it in GitHub Desktop.
fluz_balance_refresh.py
import requests
import os
import logging
import time
logging.basicConfig(
format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S')
cookies = {
}
headers = {
'accept': 'application/json',
'accept-language': 'en-US,en;q=0.9,es-US;q=0.8,es;q=0.7,zh-TW;q=0.6,zh-CN;q=0.5,zh;q=0.4',
'cache-control': 'no-cache',
'content-type': 'application/json',
'dnt': '1',
'origin': 'https://power.fluz.app',
'priority': 'u=1, i',
'referer': 'https://power.fluz.app/legacy-login',
'sec-ch-ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
}
json_data = {
'credentials': {
'username': '',
'password': '',
},
'deviceDetails': {
},
'fingerprintData': {
},
}
token = None
while True:
try:
if not token:
session = requests.Session()
response = session.post('https://power.fluz.app/api/v1/user/login', cookies=cookies, headers=headers, json=json_data)
if response.status_code != 200:
raise Exception("Response is {}".format(response.text))
token = response.json()['accessToken']
headers = {
'accept': 'application/json',
'authorization': 'Bearer {}'.format(token),
'cache-control': 'no-cache',
'content-type': 'application/json',
'dnt': '1',
'priority': 'u=1, i',
'referer': 'https://power.fluz.app/dashboard',
'sec-ch-ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
}
response = session.get('https://power.fluz.app/api/v1/user/account-balance', cookies=cookies, headers=headers)
if response.status_code != 200:
raise Exception("Response is {}".format(response.text))
response_json = response.json()
print(response_json)
time.sleep(600)
except Exception as e:
token = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment