-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_balance.py
More file actions
55 lines (42 loc) · 1.68 KB
/
Copy pathcheck_balance.py
File metadata and controls
55 lines (42 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Example: Check Account Balance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This example demonstrates how to check your FastCaptcha account balance
and credit information.
"""
from fastcaptcha import FastCaptcha, APIKeyError, APIError
def main():
# Initialize with your API key
api_key = "your-api-key-here" # Replace with your actual API key
try:
solver = FastCaptcha(api_key=api_key)
# Get balance information
print("Fetching account balance...")
balance = solver.get_balance()
# Display balance information
print("\n" + "="*50)
print("Account Balance Information")
print("="*50)
print(f"Credits Remaining: {balance.get('credits', 'N/A')}")
print(f"Total Used: {balance.get('total_used', 'N/A')}")
print(f"Account Status: {balance.get('status', 'N/A')}")
print("="*50)
# Warning if credits are low
credits = balance.get('credits', 0)
if credits < 100:
print("\n⚠ Warning: Low credits! Consider purchasing more credits.")
print(" Visit: https://fastcaptcha.org/pricing/")
elif credits < 500:
print("\n⚠ Your credits are running low.")
else:
print("\n✓ You have sufficient credits.")
solver.close()
except APIKeyError:
print("✗ Error: Invalid API key")
print(" Please check your API key at https://fastcaptcha.org/dashboard/")
except APIError as e:
print(f"✗ Error: Failed to get balance - {e}")
except Exception as e:
print(f"✗ Unexpected error: {e}")
if __name__ == "__main__":
main()