-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.json
More file actions
359 lines (359 loc) · 11.2 KB
/
schema.json
File metadata and controls
359 lines (359 loc) · 11.2 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
{
"api": {
"name": "DeathByCaptcha API Client",
"version": "4.7.0",
"description": "Python client library for DeathByCaptcha CAPTCHA solving service",
"repository": "https://github.com/deathbycaptcha/deathbycaptcha-api-client-python",
"license": "MIT",
"baseUrl": "http://api.dbcapi.me/api",
"socketHost": "api.dbcapi.me",
"socketPorts": [8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130]
},
"classes": {
"Client": {
"type": "base_class",
"description": "Abstract base class for DeathByCaptcha API clients",
"constructors": [
{
"name": "__init__",
"parameters": [
{
"name": "username",
"type": "string",
"required": false,
"description": "DBC account username"
},
{
"name": "password",
"type": "string",
"required": false,
"description": "DBC account password"
},
{
"name": "authtoken",
"type": "string",
"required": false,
"description": "Alternative authentication token"
}
]
}
],
"methods": [
{
"name": "get_user",
"description": "Fetch user details (ID, balance, rate, banned status)",
"parameters": [],
"returns": {
"type": "dict",
"keys": {
"user": {"type": "int", "description": "Account numeric ID"},
"balance": {"type": "int", "description": "Balance in US cents"},
"rate": {"type": "float", "description": "Cost per CAPTCHA in US cents"},
"is_banned": {"type": "bool", "description": "Account suspension flag"}
}
},
"raises": ["AccessDeniedException", "RuntimeError"]
},
{
"name": "get_balance",
"description": "Fetch user balance in US cents",
"parameters": [],
"returns": {
"type": "int",
"description": "Balance in US cents"
},
"raises": ["AccessDeniedException"]
},
{
"name": "get_captcha",
"description": "Fetch CAPTCHA details by ID",
"parameters": [
{
"name": "cid",
"type": "int",
"required": true,
"description": "CAPTCHA numeric ID"
}
],
"returns": {
"type": "dict",
"keys": {
"captcha": {"type": "int", "description": "CAPTCHA numeric ID"},
"text": {"type": "string", "description": "Solved CAPTCHA text (null if not solved yet)"},
"is_correct": {"type": "bool", "description": "Whether solution is correct"}
}
},
"raises": ["RuntimeError"]
},
{
"name": "get_text",
"description": "Fetch CAPTCHA text by ID",
"parameters": [
{
"name": "cid",
"type": "int",
"required": true,
"description": "CAPTCHA numeric ID"
}
],
"returns": {
"type": "string",
"description": "CAPTCHA text or None if not solved"
},
"raises": ["RuntimeError"]
},
{
"name": "upload",
"description": "Upload a CAPTCHA image for solving",
"parameters": [
{
"name": "captcha",
"type": "string | file_like_object",
"required": true,
"description": "File path or file-like object with read() method"
}
],
"returns": {
"type": "dict",
"description": "CAPTCHA details (see get_captcha)"
},
"raises": ["ValueError", "TypeError", "AccessDeniedException"]
},
{
"name": "decode",
"description": "Upload and solve CAPTCHA with polling",
"parameters": [
{
"name": "captcha",
"type": "string | file_like_object",
"required": true,
"description": "File path or file-like object with read() method"
},
{
"name": "timeout",
"type": "int",
"required": false,
"default": 60,
"description": "Maximum time to wait for solution in seconds"
},
{
"name": "**kwargs",
"type": "dict",
"required": false,
"description": "Additional CAPTCHA parameters (banner, token_params, etc.)"
}
],
"returns": {
"type": "dict | None",
"description": "CAPTCHA details if solved, None otherwise"
},
"raises": ["ValueError", "TypeError", "AccessDeniedException", "TimeoutError"]
},
{
"name": "report",
"description": "Report incorrectly solved CAPTCHA for refund",
"parameters": [
{
"name": "cid",
"type": "int",
"required": true,
"description": "CAPTCHA numeric ID"
}
],
"returns": {
"type": "bool",
"description": "True if reported successfully"
},
"raises": ["RuntimeError"]
},
{
"name": "close",
"description": "Close client connection (if applicable)",
"parameters": [],
"returns": {"type": "None"}
},
{
"name": "connect",
"description": "Establish connection (if applicable)",
"parameters": [],
"returns": {"type": "None"}
}
]
},
"SocketClient": {
"type": "class",
"extends": "Client",
"description": "Socket API client - recommended for agents, persistent connection",
"characteristics": {
"thread_safe": true,
"persistent_connection": true,
"lower_latency": true,
"best_for": ["long_running_processes", "high_volume_solving"]
},
"additional_methods": [
{
"name": "connect",
"description": "Establish persistent socket connection to DBC API",
"parameters": [],
"returns": {"type": "socket.socket"}
},
{
"name": "close",
"description": "Close socket connection gracefully",
"parameters": [],
"returns": {"type": "None"}
}
]
},
"HttpClient": {
"type": "class",
"extends": "Client",
"description": "HTTP API client - stateless, good for serverless",
"characteristics": {
"stateless": true,
"lower_memory": true,
"serverless_friendly": true,
"best_for": ["serverless_functions", "simple_workflows", "occasional_solving"]
}
}
},
"exceptions": {
"AccessDeniedException": {
"description": "Authentication failed or insufficient balance",
"base": "Exception",
"causes": [
"Invalid username/password",
"Account has zero or negative balance",
"Account is banned"
]
},
"ValueError": {
"description": "Invalid CAPTCHA image or format",
"causes": [
"Empty image file",
"Unsupported image format",
"Invalid CAPTCHA parameters"
]
},
"TypeError": {
"description": "Invalid image type",
"causes": [
"Image format not supported",
"Invalid file-like object"
]
},
"OverflowError": {
"description": "Service overloaded (HTTP 503)",
"causes": [
"DBC service at capacity",
"Too many requests from your account"
],
"recommendation": "Retry with exponential backoff"
},
"RuntimeError": {
"description": "Invalid API response or network error",
"causes": [
"Network connectivity issue",
"API server error",
"Malformed response"
]
}
},
"constants": {
"API_VERSION": {
"type": "string",
"value": "DBC/Python v4.7.0"
},
"DEFAULT_TIMEOUT": {
"type": "int",
"value": 60,
"description": "Default CAPTCHA solving timeout in seconds"
},
"DEFAULT_TOKEN_TIMEOUT": {
"type": "int",
"value": 120,
"description": "Default token solving timeout in seconds"
},
"POLLS_INTERVAL": {
"type": "list[int]",
"value": [1, 1, 2, 3, 2, 2, 3, 2, 2],
"description": "Polling intervals in seconds for status checks"
},
"DFLT_POLL_INTERVAL": {
"type": "int",
"value": 3,
"description": "Default polling interval after exhausting POLLS_INTERVAL"
},
"HTTP_BASE_URL": {
"type": "string",
"value": "http://api.dbcapi.me/api"
},
"SOCKET_HOST": {
"type": "string",
"value": "api.dbcapi.me"
},
"SOCKET_PORTS": {
"type": "list[int]",
"value": [8123, 8124, 8125, 8126, 8127, 8128, 8129, 8130]
}
},
"common_workflows": {
"check_balance": {
"description": "Check account balance before solving",
"steps": [
"Instantiate client",
"Call get_balance()",
"Check if balance > 0"
],
"cost": "Free"
},
"solve_simple_captcha": {
"description": "Solve a standard image CAPTCHA",
"steps": [
"Instantiate client",
"Call decode(image_path, timeout=60)",
"Extract text from response"
],
"cost": "$0.005 - $0.05"
},
"batch_solve_captchas": {
"description": "Solve multiple CAPTCHAs efficiently",
"steps": [
"Create SocketClient (reuse for multiple calls)",
"Iterate over images",
"Call decode() for each",
"Track balance to avoid overspending",
"Close client when done"
]
},
"handle_failures": {
"description": "Robust error handling",
"steps": [
"Wrap decode() in try-except",
"Handle AccessDeniedException separately",
"Implement exponential backoff for retries",
"Log errors for debugging"
]
}
},
"examples": {
"basic_usage": {
"language": "python",
"code": "import deathbycaptcha\nclient = deathbycaptcha.SocketClient('username', 'password')\nresult = client.decode('captcha.png', timeout=60)\nif result:\n print(f'CAPTCHA: {result[\"text\"]}')\nclient.close()"
},
"batch_processing": {
"language": "python",
"code": "client = deathbycaptcha.SocketClient('username', 'password')\nimages = ['cap1.png', 'cap2.png', 'cap3.png']\nfor img in images:\n r = client.decode(img)\n if r: print(f'{img}: {r[\"text\"]}')\nclient.close()"
},
"error_handling": {
"language": "python",
"code": "try:\n result = client.decode('captcha.png')\nexcept deathbycaptcha.AccessDeniedException:\n print('Auth failed')\nexcept ValueError:\n print('Invalid image')\nexcept Exception as e:\n print(f'Error: {e}')"
}
},
"performance_metrics": {
"typical_solve_time": "5-30 seconds",
"api_response_time": "100-500ms",
"cost_per_captcha": "$0.005 - $0.15",
"max_concurrent_requests": "Unlimited (pay per solve)"
}
}