Advertisement
ExamV1

2Captcha Balance Checker

Mar 7th, 2023
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  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/2captcha-Balance-Checker?v=1
  3.  
  4. import requests
  5. import os
  6. import time
  7.  
  8. def get_balance(api_key):
  9.     url = f"https://2captcha.com/res.php?key={api_key}&action=getbalance"
  10.     response = requests.get(url)
  11.     if response.status_code == 200:
  12.         if response.text.startswith("ERROR"):
  13.             return None
  14.         else:
  15.             return float(response.text)
  16.     else:
  17.         return None
  18.  
  19. while True:
  20.     api_key = input("Enter your 2captcha API key: ")
  21.     balance = get_balance(api_key)
  22.     if balance is not None:
  23.         break
  24.     else:
  25.         print("Incorrect API key. Please try again.")
  26.  
  27. print(f"Press Enter to refresh your balance.\n You cureently have ${balance:.2f}")
  28.  
  29. while True:
  30.     command = input()
  31.     if command.lower() == "quit":
  32.         break
  33.     elif command == "":
  34.         print("Refreshing balance", end="", flush=True)
  35.         for _ in range(6):
  36.             time.sleep(0.1)
  37.             print(".", end="", flush=True)
  38.         print()
  39.         os.system("cls" if os.name == "nt" else "clear")
  40.         balance = get_balance(api_key)
  41.         if balance is not None:
  42.             print(f"Your balance is: ${balance:.2f}")
  43.         else:
  44.             print("Failed to get balance. Please check your API key and try again.")
  45.         print("Press Enter to refresh the balance")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement