fastcaptcha-api 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ """
2
+ FastCaptcha - Fastest Image CAPTCHA Solver API for Python
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ FastCaptcha is a powerful Python library for solving text-based image CAPTCHAs
6
+ using AI-powered OCR technology with 95% accuracy in under 0.3 seconds.
7
+
8
+ Basic usage:
9
+
10
+ >>> from fastcaptcha import FastCaptcha
11
+ >>> solver = FastCaptcha(api_key='your-api-key-here')
12
+ >>> result = solver.solve('captcha.jpg')
13
+ >>> print(result)
14
+ 'ABC123'
15
+
16
+ :copyright: (c) 2025 by FastCaptcha (Bijaya kumar Tiadi).
17
+ :license: MIT, see LICENSE for more details.
18
+ """
19
+
20
+ __title__ = 'fastcaptcha-api'
21
+ __version__ = '1.0.0'
22
+ __author__ = 'Bijaya kumar Tiadi'
23
+ __license__ = 'MIT'
24
+ __copyright__ = 'Copyright 2025 FastCaptcha'
25
+
26
+ from .core import FastCaptcha
27
+ from .exceptions import (
28
+ FastCaptchaException,
29
+ APIKeyError,
30
+ InvalidImageError,
31
+ APIError,
32
+ TimeoutError
33
+ )
34
+
35
+ __all__ = [
36
+ 'FastCaptcha',
37
+ 'FastCaptchaException',
38
+ 'APIKeyError',
39
+ 'InvalidImageError',
40
+ 'APIError',
41
+ 'TimeoutError'
42
+ ]
fastcaptcha/core.py ADDED
@@ -0,0 +1,279 @@
1
+ """
2
+ FastCaptcha Core Module
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ This module contains the main FastCaptcha class for solving image CAPTCHAs.
6
+ """
7
+
8
+ import base64
9
+ import requests
10
+ from typing import Optional, Union
11
+ from pathlib import Path
12
+
13
+ from .exceptions import APIKeyError, InvalidImageError, APIError, TimeoutError
14
+ from .utils import validate_image_path, is_valid_url, download_image
15
+
16
+
17
+ class FastCaptcha:
18
+ """
19
+ FastCaptcha solver class for solving text-based image CAPTCHAs.
20
+
21
+ This class provides methods to solve CAPTCHAs from local files, URLs,
22
+ or base64-encoded images using the FastCaptcha API.
23
+
24
+ Args:
25
+ api_key (str): Your FastCaptcha API key
26
+ base_url (str, optional): Custom API endpoint. Defaults to production API.
27
+ timeout (int, optional): Request timeout in seconds. Defaults to 30.
28
+
29
+ Example:
30
+ >>> solver = FastCaptcha(api_key='your-api-key')
31
+ >>> result = solver.solve('captcha.jpg')
32
+ >>> print(result)
33
+ 'ABC123'
34
+ """
35
+
36
+ DEFAULT_API_URL = "https://fastcaptcha.org/api/v1/ocr/"
37
+
38
+ def __init__(
39
+ self,
40
+ api_key: str,
41
+ base_url: Optional[str] = None,
42
+ timeout: int = 30
43
+ ):
44
+ """
45
+ Initialize FastCaptcha solver.
46
+
47
+ Args:
48
+ api_key: Your FastCaptcha API key
49
+ base_url: Custom API endpoint (optional)
50
+ timeout: Request timeout in seconds (default: 30)
51
+
52
+ Raises:
53
+ APIKeyError: If API key is invalid or missing
54
+ """
55
+ if not api_key or not isinstance(api_key, str):
56
+ raise APIKeyError("API key must be a non-empty string")
57
+
58
+ self.api_key = api_key.strip()
59
+ self.base_url = base_url or self.DEFAULT_API_URL
60
+ self.timeout = timeout
61
+ self._session = requests.Session()
62
+ self._session.headers.update({
63
+ 'User-Agent': f'FastCaptcha-Python/{self.__class__.__module__}'
64
+ })
65
+
66
+ def solve(self, image: Union[str, Path], **kwargs) -> str:
67
+ """
68
+ Solve a CAPTCHA from a file path or URL.
69
+
70
+ Args:
71
+ image: Path to image file or image URL
72
+ **kwargs: Additional parameters to pass to the API
73
+
74
+ Returns:
75
+ str: Solved CAPTCHA text
76
+
77
+ Raises:
78
+ InvalidImageError: If image is invalid or cannot be read
79
+ APIError: If API request fails
80
+ TimeoutError: If request times out
81
+
82
+ Example:
83
+ >>> solver = FastCaptcha(api_key='your-api-key')
84
+ >>> # From file
85
+ >>> result = solver.solve('captcha.jpg')
86
+ >>> # From URL
87
+ >>> result = solver.solve('https://example.com/captcha.png')
88
+ """
89
+ image_str = str(image)
90
+
91
+ # Handle URL
92
+ if is_valid_url(image_str):
93
+ return self.solve_url(image_str, **kwargs)
94
+
95
+ # Handle file path
96
+ if not validate_image_path(image_str):
97
+ raise InvalidImageError(f"Invalid image path: {image_str}")
98
+
99
+ with open(image_str, 'rb') as f:
100
+ image_data = f.read()
101
+
102
+ return self._solve_image_data(image_data, **kwargs)
103
+
104
+ def solve_url(self, url: str, **kwargs) -> str:
105
+ """
106
+ Solve a CAPTCHA from a URL.
107
+
108
+ Args:
109
+ url: URL of the CAPTCHA image
110
+ **kwargs: Additional parameters to pass to the API
111
+
112
+ Returns:
113
+ str: Solved CAPTCHA text
114
+
115
+ Raises:
116
+ InvalidImageError: If URL is invalid or image cannot be downloaded
117
+ APIError: If API request fails
118
+
119
+ Example:
120
+ >>> solver = FastCaptcha(api_key='your-api-key')
121
+ >>> result = solver.solve_url('https://example.com/captcha.png')
122
+ """
123
+ if not is_valid_url(url):
124
+ raise InvalidImageError(f"Invalid URL: {url}")
125
+
126
+ try:
127
+ image_data = download_image(url, timeout=self.timeout)
128
+ except Exception as e:
129
+ raise InvalidImageError(f"Failed to download image from URL: {str(e)}")
130
+
131
+ return self._solve_image_data(image_data, **kwargs)
132
+
133
+ def solve_base64(self, base64_string: str, **kwargs) -> str:
134
+ """
135
+ Solve a CAPTCHA from a base64-encoded image.
136
+
137
+ Args:
138
+ base64_string: Base64-encoded image string
139
+ **kwargs: Additional parameters to pass to the API
140
+
141
+ Returns:
142
+ str: Solved CAPTCHA text
143
+
144
+ Raises:
145
+ InvalidImageError: If base64 string is invalid
146
+ APIError: If API request fails
147
+
148
+ Example:
149
+ >>> solver = FastCaptcha(api_key='your-api-key')
150
+ >>> b64_image = "iVBORw0KGgoAAAANSUhEUgAA..."
151
+ >>> result = solver.solve_base64(b64_image)
152
+ """
153
+ try:
154
+ # Remove data URI prefix if present
155
+ if ',' in base64_string:
156
+ base64_string = base64_string.split(',')[1]
157
+
158
+ image_data = base64.b64decode(base64_string)
159
+ except Exception as e:
160
+ raise InvalidImageError(f"Invalid base64 string: {str(e)}")
161
+
162
+ return self._solve_image_data(image_data, **kwargs)
163
+
164
+ def _solve_image_data(self, image_data: bytes, **kwargs) -> str:
165
+ """
166
+ Internal method to solve CAPTCHA from raw image bytes.
167
+
168
+ Args:
169
+ image_data: Raw image bytes
170
+ **kwargs: Additional parameters to pass to the API
171
+
172
+ Returns:
173
+ str: Solved CAPTCHA text
174
+
175
+ Raises:
176
+ APIError: If API request fails
177
+ TimeoutError: If request times out
178
+ """
179
+ # Encode image to base64
180
+ image_base64 = base64.b64encode(image_data).decode('utf-8')
181
+
182
+ # Prepare request payload
183
+ payload = {
184
+ 'image': image_base64,
185
+ **kwargs
186
+ }
187
+
188
+ headers = {
189
+ 'X-API-Key': self.api_key,
190
+ 'Content-Type': 'application/json'
191
+ }
192
+
193
+ try:
194
+ response = self._session.post(
195
+ self.base_url,
196
+ json=payload,
197
+ headers=headers,
198
+ timeout=self.timeout
199
+ )
200
+
201
+ # Handle API errors
202
+ if response.status_code == 401:
203
+ raise APIKeyError("Invalid API key")
204
+ elif response.status_code == 400:
205
+ error_msg = response.json().get('error', 'Bad request')
206
+ raise InvalidImageError(f"API returned error: {error_msg}")
207
+ elif response.status_code != 200:
208
+ raise APIError(
209
+ f"API request failed with status {response.status_code}: "
210
+ f"{response.text}"
211
+ )
212
+
213
+ # Parse response
214
+ result = response.json()
215
+
216
+ if 'text' not in result:
217
+ raise APIError("Invalid API response format")
218
+
219
+ return result['text']
220
+
221
+ except requests.exceptions.Timeout:
222
+ raise TimeoutError(
223
+ f"Request timed out after {self.timeout} seconds"
224
+ )
225
+ except requests.exceptions.RequestException as e:
226
+ raise APIError(f"Network error: {str(e)}")
227
+
228
+ def get_balance(self) -> dict:
229
+ """
230
+ Get account balance and credit information.
231
+
232
+ Returns:
233
+ dict: Account balance information
234
+
235
+ Raises:
236
+ APIError: If API request fails
237
+
238
+ Example:
239
+ >>> solver = FastCaptcha(api_key='your-api-key')
240
+ >>> balance = solver.get_balance()
241
+ >>> print(f"Credits remaining: {balance['credits']}")
242
+ """
243
+ headers = {
244
+ 'X-API-Key': self.api_key
245
+ }
246
+
247
+ try:
248
+ response = self._session.get(
249
+ self.base_url.replace('/ocr/', '/balance/'),
250
+ headers=headers,
251
+ timeout=self.timeout
252
+ )
253
+
254
+ if response.status_code == 401:
255
+ raise APIKeyError("Invalid API key")
256
+ elif response.status_code != 200:
257
+ raise APIError(
258
+ f"Failed to get balance. Status: {response.status_code}"
259
+ )
260
+
261
+ return response.json()
262
+
263
+ except requests.exceptions.RequestException as e:
264
+ raise APIError(f"Network error: {str(e)}")
265
+
266
+ def close(self):
267
+ """Close the HTTP session."""
268
+ self._session.close()
269
+
270
+ def __enter__(self):
271
+ """Context manager entry."""
272
+ return self
273
+
274
+ def __exit__(self, exc_type, exc_val, exc_tb):
275
+ """Context manager exit."""
276
+ self.close()
277
+
278
+ def __repr__(self):
279
+ return f"<FastCaptcha(api_key='***{self.api_key[-4:]}')>"
@@ -0,0 +1,31 @@
1
+ """
2
+ FastCaptcha Exceptions
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Custom exceptions for FastCaptcha library.
6
+ """
7
+
8
+
9
+ class FastCaptchaException(Exception):
10
+ """Base exception for all FastCaptcha errors."""
11
+ pass
12
+
13
+
14
+ class APIKeyError(FastCaptchaException):
15
+ """Raised when API key is invalid or missing."""
16
+ pass
17
+
18
+
19
+ class InvalidImageError(FastCaptchaException):
20
+ """Raised when image is invalid or cannot be processed."""
21
+ pass
22
+
23
+
24
+ class APIError(FastCaptchaException):
25
+ """Raised when API request fails."""
26
+ pass
27
+
28
+
29
+ class TimeoutError(FastCaptchaException):
30
+ """Raised when API request times out."""
31
+ pass
fastcaptcha/utils.py ADDED
@@ -0,0 +1,111 @@
1
+ """
2
+ FastCaptcha Utility Functions
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Helper functions for image validation and processing.
6
+ """
7
+
8
+ import os
9
+ import re
10
+ from pathlib import Path
11
+ from typing import Union
12
+ import requests
13
+
14
+
15
+ def validate_image_path(path: Union[str, Path]) -> bool:
16
+ """
17
+ Validate if the given path points to a valid image file.
18
+
19
+ Args:
20
+ path: Path to image file
21
+
22
+ Returns:
23
+ bool: True if valid image file exists, False otherwise
24
+ """
25
+ if not path:
26
+ return False
27
+
28
+ path_obj = Path(path)
29
+
30
+ # Check if file exists
31
+ if not path_obj.exists():
32
+ return False
33
+
34
+ # Check if it's a file (not directory)
35
+ if not path_obj.is_file():
36
+ return False
37
+
38
+ # Check file extension
39
+ valid_extensions = {'.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp'}
40
+ if path_obj.suffix.lower() not in valid_extensions:
41
+ return False
42
+
43
+ return True
44
+
45
+
46
+ def is_valid_url(url: str) -> bool:
47
+ """
48
+ Check if the given string is a valid URL.
49
+
50
+ Args:
51
+ url: URL string to validate
52
+
53
+ Returns:
54
+ bool: True if valid URL, False otherwise
55
+ """
56
+ if not url or not isinstance(url, str):
57
+ return False
58
+
59
+ # Simple URL validation regex
60
+ url_pattern = re.compile(
61
+ r'^https?://' # http:// or https://
62
+ r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+[A-Z]{2,6}\.?|' # domain
63
+ r'localhost|' # localhost
64
+ r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # IP
65
+ r'(?::\d+)?' # optional port
66
+ r'(?:/?|[/?]\S+)$', re.IGNORECASE
67
+ )
68
+
69
+ return bool(url_pattern.match(url))
70
+
71
+
72
+ def download_image(url: str, timeout: int = 30) -> bytes:
73
+ """
74
+ Download image from URL.
75
+
76
+ Args:
77
+ url: Image URL
78
+ timeout: Request timeout in seconds
79
+
80
+ Returns:
81
+ bytes: Image data
82
+
83
+ Raises:
84
+ Exception: If download fails
85
+ """
86
+ response = requests.get(url, timeout=timeout)
87
+ response.raise_for_status()
88
+
89
+ # Verify content type
90
+ content_type = response.headers.get('content-type', '').lower()
91
+ if not content_type.startswith('image/'):
92
+ raise ValueError(f"URL does not point to an image. Content-Type: {content_type}")
93
+
94
+ return response.content
95
+
96
+
97
+ def format_file_size(size_bytes: int) -> str:
98
+ """
99
+ Format file size in human-readable format.
100
+
101
+ Args:
102
+ size_bytes: File size in bytes
103
+
104
+ Returns:
105
+ str: Formatted file size (e.g., "1.5 MB")
106
+ """
107
+ for unit in ['B', 'KB', 'MB', 'GB']:
108
+ if size_bytes < 1024.0:
109
+ return f"{size_bytes:.1f} {unit}"
110
+ size_bytes /= 1024.0
111
+ return f"{size_bytes:.1f} TB"
@@ -0,0 +1,493 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastcaptcha-api
3
+ Version: 1.0.0
4
+ Summary: Fastest AI-powered image CAPTCHA solver API for Python with 95% accuracy
5
+ Home-page: https://github.com/fastcaptcha/fastcaptcha
6
+ Author: Bijaya kumar Tiadi
7
+ Author-email: Bijaya kumar Tiadi <contact@fastcaptcha.org>
8
+ License: MIT
9
+ Project-URL: Homepage, https://fastcaptcha.org
10
+ Project-URL: Documentation, https://fastcaptcha.org/api-docs/
11
+ Project-URL: Repository, https://github.com/fastcaptcha/fastcaptcha
12
+ Project-URL: Bug Tracker, https://github.com/fastcaptcha/fastcaptcha/issues
13
+ Keywords: captcha,captcha solver,fast captcha,python captcha api,captcha ocr,ai captcha solver,image captcha,captcha recognition,automated captcha solver,ocr api,web scraping,automation
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Topic :: Internet :: WWW/HTTP
26
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
27
+ Classifier: Operating System :: OS Independent
28
+ Requires-Python: >=3.7
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: requests>=2.25.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=6.0; extra == "dev"
34
+ Requires-Dist: pytest-cov>=2.0; extra == "dev"
35
+ Requires-Dist: black>=21.0; extra == "dev"
36
+ Requires-Dist: flake8>=3.9; extra == "dev"
37
+ Requires-Dist: mypy>=0.900; extra == "dev"
38
+ Dynamic: author
39
+ Dynamic: home-page
40
+ Dynamic: license-file
41
+ Dynamic: requires-python
42
+
43
+ # FastCaptcha - Fastest Image CAPTCHA Solver API for Python 🚀
44
+
45
+ [![PyPI version](https://badge.fury.io/py/fastcaptcha-api.svg)](https://badge.fury.io/py/fastcaptcha-api)
46
+ [![Python Versions](https://img.shields.io/pypi/pyversions/fastcaptcha-api.svg)](https://pypi.org/project/fastcaptcha-api/)
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
48
+ [![Downloads](https://pepy.tech/badge/fastcaptcha-api)](https://pepy.tech/project/fastcaptcha-api)
49
+
50
+ **FastCaptcha** is the fastest AI-powered image CAPTCHA solver API for Python with **95% accuracy** in under **0.3 seconds**. Perfect for web scraping, automation, bot development, and testing.
51
+
52
+ ---
53
+
54
+ ## 🚀 What is FastCaptcha?
55
+
56
+ FastCaptcha is a powerful Python library that solves text-based image CAPTCHAs using advanced AI and OCR technology. Unlike traditional CAPTCHA solvers, FastCaptcha provides:
57
+
58
+ - ⚡ **Lightning-Fast** - Solve CAPTCHAs in under 0.3 seconds
59
+ - 🎯 **95% Accuracy** - Industry-leading accuracy for image CAPTCHAs
60
+ - 💰 **Affordable** - Starting at $1 for 3000 CAPTCHA solves
61
+ - 🔌 **Easy Integration** - Simple Python API with one-line installation
62
+ - 🌐 **RESTful API** - Works with any programming language
63
+ - 🔒 **Secure** - Your data is encrypted and never stored
64
+
65
+ ### Supported CAPTCHA Types
66
+
67
+ FastCaptcha supports all text-based image CAPTCHAs including:
68
+ - Alphanumeric CAPTCHAs
69
+ - Numeric only CAPTCHAs
70
+ - Mixed case text CAPTCHAs
71
+ - Distorted text CAPTCHAs
72
+ - Noisy background CAPTCHAs
73
+ - High contrast CAPTCHAs
74
+ - Multi-line CAPTCHAs
75
+ - Complex pattern CAPTCHAs
76
+
77
+ ---
78
+
79
+ ## 🔧 Installation
80
+
81
+ Install FastCaptcha using pip:
82
+
83
+ ```bash
84
+ pip install fastcaptcha-api
85
+ ```
86
+
87
+ That's it! No complex setup, no dependencies issues.
88
+
89
+ ### Requirements
90
+ - Python 3.7 or higher
91
+ - `requests` library (auto-installed)
92
+
93
+ ---
94
+
95
+ ## 🧩 Quick Start Example
96
+
97
+ Get started in just 3 lines of code:
98
+
99
+ ```python
100
+ from fastcaptcha import FastCaptcha
101
+
102
+ # Initialize with your API key
103
+ solver = FastCaptcha(api_key="your-api-key-here")
104
+
105
+ # Solve a CAPTCHA
106
+ result = solver.solve("captcha.jpg")
107
+ print(result) # Output: "ABC123"
108
+ ```
109
+
110
+ ### Get Your Free API Key
111
+
112
+ 1. Visit [FastCaptcha.org](https://fastcaptcha.org)
113
+ 2. Sign up for free
114
+ 3. Get **100 free credits** to start
115
+ 4. Copy your API key from the dashboard
116
+
117
+ ---
118
+
119
+ ## 💡 Why FastCaptcha?
120
+
121
+ ### Compare FastCaptcha vs Other CAPTCHA Solvers
122
+
123
+ | Feature | FastCaptcha | 2Captcha | AntiCaptcha | TrueCaptcha |
124
+ |---------|-------------|----------|-------------|-------------|
125
+ | **Speed** | **0.3s** | 10-30s | 5-20s | 3-10s |
126
+ | **Accuracy** | **95%** | 80-85% | 75-80% | 70-75% |
127
+ | **Price per 1000** | **$0.33** | $1.00 | $1.50 | $2.00 |
128
+ | **Python Library** | ✅ | ❌ | ❌ | ❌ |
129
+ | **API Quality** | ✅ | ⚠️ | ⚠️ | ❌ |
130
+ | **Free Credits** | 100 | 0 | 0 | 50 |
131
+
132
+ ### Key Advantages
133
+
134
+ ✅ **10x Faster** - Solve CAPTCHAs in 0.3 seconds vs 10-30 seconds with competitors
135
+ ✅ **3x Cheaper** - $0.33 per 1000 solves vs $1-$2 with other services
136
+ ✅ **Higher Accuracy** - 95% accuracy vs 70-85% industry average
137
+ ✅ **Better Developer Experience** - Native Python library, not just API wrapper
138
+ ✅ **No Hidden Costs** - Pay only for what you use, credits never expire
139
+
140
+ ---
141
+
142
+ ## 📦 Complete Usage Guide
143
+
144
+ ### Basic Usage
145
+
146
+ #### Solve from Local File
147
+
148
+ ```python
149
+ from fastcaptcha import FastCaptcha
150
+
151
+ solver = FastCaptcha(api_key="your-api-key")
152
+ result = solver.solve("path/to/captcha.jpg")
153
+ print(f"Solved: {result}")
154
+ ```
155
+
156
+ #### Solve from URL
157
+
158
+ ```python
159
+ from fastcaptcha import FastCaptcha
160
+
161
+ solver = FastCaptcha(api_key="your-api-key")
162
+ result = solver.solve_url("https://example.com/captcha.png")
163
+ print(f"Solved: {result}")
164
+ ```
165
+
166
+ #### Solve from Base64
167
+
168
+ ```python
169
+ from fastcaptcha import FastCaptcha
170
+
171
+ solver = FastCaptcha(api_key="your-api-key")
172
+ base64_image = "iVBORw0KGgoAAAANSUhEUgAA..."
173
+ result = solver.solve_base64(base64_image)
174
+ print(f"Solved: {result}")
175
+ ```
176
+
177
+ ### Advanced Usage
178
+
179
+ #### Context Manager (Recommended)
180
+
181
+ ```python
182
+ from fastcaptcha import FastCaptcha
183
+
184
+ with FastCaptcha(api_key="your-api-key") as solver:
185
+ result = solver.solve("captcha.jpg")
186
+ print(f"Solved: {result}")
187
+ # Session automatically closed
188
+ ```
189
+
190
+ #### Check Account Balance
191
+
192
+ ```python
193
+ from fastcaptcha import FastCaptcha
194
+
195
+ solver = FastCaptcha(api_key="your-api-key")
196
+ balance = solver.get_balance()
197
+ print(f"Credits remaining: {balance['credits']}")
198
+ ```
199
+
200
+ #### Error Handling
201
+
202
+ ```python
203
+ from fastcaptcha import FastCaptcha, APIKeyError, InvalidImageError, APIError
204
+
205
+ try:
206
+ solver = FastCaptcha(api_key="your-api-key")
207
+ result = solver.solve("captcha.jpg")
208
+ print(f"Solved: {result}")
209
+ except APIKeyError:
210
+ print("Invalid API key")
211
+ except InvalidImageError as e:
212
+ print(f"Invalid image: {e}")
213
+ except APIError as e:
214
+ print(f"API error: {e}")
215
+ ```
216
+
217
+ #### Batch Processing
218
+
219
+ ```python
220
+ from fastcaptcha import FastCaptcha
221
+ import glob
222
+
223
+ solver = FastCaptcha(api_key="your-api-key")
224
+
225
+ # Solve multiple CAPTCHAs
226
+ captcha_files = glob.glob("captchas/*.jpg")
227
+ for captcha_file in captcha_files:
228
+ try:
229
+ result = solver.solve(captcha_file)
230
+ print(f"{captcha_file}: {result}")
231
+ except Exception as e:
232
+ print(f"{captcha_file}: Error - {e}")
233
+ ```
234
+
235
+ #### Custom Timeout
236
+
237
+ ```python
238
+ from fastcaptcha import FastCaptcha
239
+
240
+ # Set custom timeout (default is 30 seconds)
241
+ solver = FastCaptcha(api_key="your-api-key", timeout=60)
242
+ result = solver.solve("captcha.jpg")
243
+ ```
244
+
245
+ ---
246
+
247
+ ## 🌐 Integration Examples
248
+
249
+ ### Web Scraping with Selenium
250
+
251
+ ```python
252
+ from selenium import webdriver
253
+ from fastcaptcha import FastCaptcha
254
+ import base64
255
+
256
+ driver = webdriver.Chrome()
257
+ solver = FastCaptcha(api_key="your-api-key")
258
+
259
+ # Navigate to page with CAPTCHA
260
+ driver.get("https://example.com/login")
261
+
262
+ # Get CAPTCHA image
263
+ captcha_element = driver.find_element_by_id("captcha-image")
264
+ captcha_base64 = captcha_element.screenshot_as_base64
265
+
266
+ # Solve CAPTCHA
267
+ result = solver.solve_base64(captcha_base64)
268
+
269
+ # Enter solution
270
+ input_field = driver.find_element_by_id("captcha-input")
271
+ input_field.send_keys(result)
272
+ ```
273
+
274
+ ### Requests Library
275
+
276
+ ```python
277
+ import requests
278
+ from fastcaptcha import FastCaptcha
279
+
280
+ # Download CAPTCHA image
281
+ response = requests.get("https://example.com/captcha")
282
+ with open("captcha.jpg", "wb") as f:
283
+ f.write(response.content)
284
+
285
+ # Solve CAPTCHA
286
+ solver = FastCaptcha(api_key="your-api-key")
287
+ result = solver.solve("captcha.jpg")
288
+
289
+ # Submit form with solution
290
+ data = {"captcha": result, "username": "user"}
291
+ requests.post("https://example.com/submit", data=data)
292
+ ```
293
+
294
+ ### Flask API Integration
295
+
296
+ ```python
297
+ from flask import Flask, request, jsonify
298
+ from fastcaptcha import FastCaptcha
299
+ import base64
300
+
301
+ app = Flask(__name__)
302
+ solver = FastCaptcha(api_key="your-api-key")
303
+
304
+ @app.route('/solve', methods=['POST'])
305
+ def solve_captcha():
306
+ data = request.json
307
+ image_base64 = data.get('image')
308
+
309
+ try:
310
+ result = solver.solve_base64(image_base64)
311
+ return jsonify({"success": True, "text": result})
312
+ except Exception as e:
313
+ return jsonify({"success": False, "error": str(e)})
314
+
315
+ if __name__ == '__main__':
316
+ app.run()
317
+ ```
318
+
319
+ ---
320
+
321
+ ## 🌐 API Documentation
322
+
323
+ For complete API documentation, visit: [https://fastcaptcha.org/api-docs/](https://fastcaptcha.org/api-docs/)
324
+
325
+ ### API Endpoint
326
+
327
+ ```
328
+ POST https://fastcaptcha.org/api/v1/ocr/
329
+ ```
330
+
331
+ ### Request Format
332
+
333
+ ```json
334
+ {
335
+ "image": "base64_encoded_image_here"
336
+ }
337
+ ```
338
+
339
+ ### Response Format
340
+
341
+ ```json
342
+ {
343
+ "success": true,
344
+ "text": "ABC123",
345
+ "processing_time": 0.28
346
+ }
347
+ ```
348
+
349
+ ---
350
+
351
+ ## 📊 Pricing
352
+
353
+ FastCaptcha offers the most competitive pricing in the industry:
354
+
355
+ | Package | Credits | Price | Price per 1000 |
356
+ |---------|---------|-------|----------------|
357
+ | **Starter** | 500 | FREE | $0.00 |
358
+ | **Budget** | 3000 | $1 | $0.33 |
359
+ | **Basic** | 10000 | $3 | $0.30 |
360
+ | **Pro** | 50000 | $12 | $0.24 |
361
+ | **Business** | 200000 | $40 | $0.20 |
362
+
363
+ - ✅ No monthly subscriptions
364
+ - ✅ Pay only for what you use
365
+ - ✅ Credits never expire
366
+ - ✅ Volume discounts available
367
+ - ✅ Free 100 credits on signup
368
+
369
+ [View All Pricing Plans →](https://fastcaptcha.org/pricing/)
370
+
371
+ ---
372
+
373
+ ## 🏆 Use Cases
374
+
375
+ FastCaptcha is perfect for:
376
+
377
+ - 🕷️ **Web Scraping** - Bypass CAPTCHAs while collecting data
378
+ - 🤖 **Automation** - Automate form submissions and testing
379
+ - 🧪 **QA Testing** - Test CAPTCHA-protected features
380
+ - 📊 **Data Collection** - Gather data from protected websites
381
+ - 🔄 **API Integration** - Add CAPTCHA solving to your API
382
+ - 🎮 **Bot Development** - Build bots that can solve CAPTCHAs
383
+ - 🌐 **Multi-Account Management** - Manage multiple accounts efficiently
384
+
385
+ ---
386
+
387
+ ## 📈 SEO Keywords
388
+
389
+ This library is optimized for developers searching for:
390
+
391
+ **Primary Keywords:**
392
+ - Fast CAPTCHA solver Python
393
+ - Best CAPTCHA solver API
394
+ - CAPTCHA OCR Python
395
+ - AI CAPTCHA solver
396
+ - Python CAPTCHA recognition
397
+ - Automated CAPTCHA solver
398
+ - Image CAPTCHA solver
399
+
400
+ **Alternative to:**
401
+ - 2Captcha Python
402
+ - AntiCaptcha Python
403
+ - TrueCaptcha alternative
404
+ - DeathByCaptcha alternative
405
+ - ImageTyperz alternative
406
+
407
+ **Use Cases:**
408
+ - CAPTCHA bypass Python
409
+ - Web scraping CAPTCHA solver
410
+ - Selenium CAPTCHA solver
411
+ - Automation CAPTCHA solver
412
+ - Bot CAPTCHA solver
413
+
414
+ ---
415
+
416
+ ## 📚 Examples Repository
417
+
418
+ Check out our [examples directory](./examples/) for more code samples:
419
+
420
+ - `solve_single_image.py` - Basic CAPTCHA solving
421
+ - `solve_from_url.py` - Solve CAPTCHAs from URLs
422
+ - `batch_processing.py` - Process multiple CAPTCHAs
423
+ - `selenium_integration.py` - Integrate with Selenium
424
+ - `error_handling.py` - Proper error handling
425
+
426
+ ---
427
+
428
+ ## 🔒 Security & Privacy
429
+
430
+ - 🔐 All API requests are encrypted with HTTPS
431
+ - 🗑️ Images are deleted immediately after processing
432
+ - 🚫 We never store or log your CAPTCHA images
433
+ - ✅ GDPR and CCPA compliant
434
+ - 🛡️ Enterprise-grade security
435
+
436
+ ---
437
+
438
+ ## 🤝 Support
439
+
440
+ Need help? We're here for you:
441
+
442
+ - 📧 **Email**: [contact@fastcaptcha.org](mailto:contact@fastcaptcha.org)
443
+ - 📖 **Documentation**: [fastcaptcha.org/api-docs/](https://fastcaptcha.org/api-docs/)
444
+ - 💬 **GitHub Issues**: [Report a bug](https://github.com/fastcaptcha/fastcaptcha/issues)
445
+ - 🌐 **Website**: [fastcaptcha.org](https://fastcaptcha.org)
446
+ - ❓ **FAQ**: [fastcaptcha.org/faq/](https://fastcaptcha.org/faq/)
447
+
448
+ ---
449
+
450
+ ## 📝 License
451
+
452
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
453
+
454
+ ---
455
+
456
+ ## 🌟 Why Developers Love FastCaptcha
457
+
458
+ > "Switched from 2Captcha to FastCaptcha and my scraping scripts are now 10x faster. Best decision ever!" - *John D., Data Engineer*
459
+
460
+ > "The Python library is so easy to use. Integrated it in 5 minutes. Accuracy is incredible!" - *Sarah M., Full Stack Developer*
461
+
462
+ > "Finally, a CAPTCHA solver that's actually fast and affordable. Saved my company $500/month!" - *Mike R., DevOps Engineer*
463
+
464
+ ---
465
+
466
+ ## 🚀 Get Started Now
467
+
468
+ 1. **Install**: `pip install fastcaptcha-api`
469
+ 2. **Sign Up**: [Get your free API key](https://fastcaptcha.org)
470
+ 3. **Solve**: Start solving CAPTCHAs in seconds!
471
+
472
+ ```python
473
+ from fastcaptcha import FastCaptcha
474
+
475
+ solver = FastCaptcha(api_key="your-api-key")
476
+ print(solver.solve("captcha.jpg"))
477
+ ```
478
+
479
+ ---
480
+
481
+ ## 🔗 Links
482
+
483
+ - 🌐 **Website**: [fastcaptcha.org](https://fastcaptcha.org)
484
+ - 📖 **API Docs**: [fastcaptcha.org/api-docs/](https://fastcaptcha.org/api-docs/)
485
+ - 💰 **Pricing**: [fastcaptcha.org/pricing/](https://fastcaptcha.org/pricing/)
486
+ - 🎮 **Live Demo**: [fastcaptcha.org/demo/](https://fastcaptcha.org/demo/)
487
+ - 📧 **Contact**: [contact@fastcaptcha.org](mailto:contact@fastcaptcha.org)
488
+
489
+ ---
490
+
491
+ **Made with ❤️ by FastCaptcha Team**
492
+
493
+ *Copyright © 2025 FastCaptcha - All rights reserved*
@@ -0,0 +1,9 @@
1
+ fastcaptcha/__init__.py,sha256=UzLtl6iWoGrtbte9frtT75GNRv_lgAwjhOo88X0TTzE,1023
2
+ fastcaptcha/core.py,sha256=8PCFbMGC1P6HK4PeKzsw3LAqon2Ny0j605_LhzVNXQI,8955
3
+ fastcaptcha/exceptions.py,sha256=Cne6FLGs7XdcW7CrpZ7E8M8tRqRUftS9myxAVO2SlR0,615
4
+ fastcaptcha/utils.py,sha256=_UjPsmfewvIniyrkGM6CESv9TwgVIP3fZd8LlmOUFyo,2680
5
+ fastcaptcha_api-1.0.0.dist-info/licenses/LICENSE,sha256=aCdwRyrpq-6sV5CjFhKsPVDnroB0kq_FPvl_FeLhunU,1089
6
+ fastcaptcha_api-1.0.0.dist-info/METADATA,sha256=mfoAz_kad81loHwBZ5QRurAROCYN9nmXlwTHjB-aIBQ,13951
7
+ fastcaptcha_api-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ fastcaptcha_api-1.0.0.dist-info/top_level.txt,sha256=S2yOJnS3bPVL4dtByQFeF7GDFqFGLJFj5ERfdAD2XGc,12
9
+ fastcaptcha_api-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 FastCaptcha - Bijaya kumar Tiadi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ fastcaptcha