· 2 years ago · Mar 08, 2023, 12:00 AM
1#This is a simple python script that allows you to check the balance of any valid 2Captcha API key.
2#Check out it on replit! https://replit.com/@ExamV1/CapSolver-Balance-Checker?v=1
3
4import time
5import capsolver
6import os
7
8while True:
9 capsolver.api_key = input("Enter your Capsolver API key: ")
10 try:
11 balance_response = capsolver.balance()
12 if balance_response is not None and 'balance' in balance_response:
13 balance = balance_response['balance']
14 break
15 except:
16 print("Incorrect API key. Please try again.")
17
18print(f"Press Enter to refresh your balance.\n You currently have ${balance:.3f}")
19
20while True:
21 command = input()
22 if command.lower() == "quit":
23 break
24 elif command == "":
25 print("Refreshing balance", end="", flush=True)
26 for _ in range(6):
27 time.sleep(0.1)
28 print(".", end="", flush=True)
29 print()
30 os.system("cls" if os.name == "nt" else "clear")
31 try:
32 balance_response = capsolver.balance()
33 if balance_response is not None and 'balance' in balance_response:
34 balance = balance_response['balance']
35 print(f"Your balance is: {balance:.3f}")
36 else:
37 print("Failed to get balance.")
38 except:
39 print("Incorrect API key. Please try again.")
40 print("Press Enter to refresh the balance")
41 else:
42 print("Invalid command.")
43