-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolve_single_image.py
More file actions
35 lines (25 loc) · 880 Bytes
/
Copy pathsolve_single_image.py
File metadata and controls
35 lines (25 loc) · 880 Bytes
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
"""
Example: Solve a Single CAPTCHA Image
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This example demonstrates how to solve a single CAPTCHA image from a local file.
"""
from fastcaptcha import FastCaptcha
def main():
# Initialize the solver with your API key
api_key = "your-api-key-here" # Replace with your actual API key
solver = FastCaptcha(api_key=api_key)
# Path to your CAPTCHA image
image_path = "captcha.jpg" # Replace with your image path
try:
# Solve the CAPTCHA
print(f"Solving CAPTCHA from: {image_path}")
result = solver.solve(image_path)
# Print the result
print(f"✓ Solved! CAPTCHA text: {result}")
except Exception as e:
print(f"✗ Error: {e}")
finally:
# Close the session
solver.close()
if __name__ == "__main__":
main()