Official Python SDK for the NSLSolver captcha solving API
Project description
NSLSolver Python SDK
Python SDK for the NSLSolver captcha solving API.
Installation
pip install nslsolver
# async support
pip install nslsolver[async]
Quick Start
from nslsolver import NSLSolver
solver = NSLSolver("your-api-key")
# Turnstile
result = solver.solve_turnstile(
site_key="0x4AAAAAAAB...",
url="https://example.com",
)
print(result.token)
# Cloudflare challenge (proxy required)
result = solver.solve_challenge(
url="https://example.com/protected",
proxy="http://user:pass@host:port",
)
print(result.cookies, result.user_agent)
# Balance
balance = solver.get_balance()
print(balance.balance, balance.max_threads, balance.allowed_types)
Async
import asyncio
from nslsolver import AsyncNSLSolver
async def main():
async with AsyncNSLSolver("your-api-key") as solver:
result = await solver.solve_turnstile(
site_key="0x4AAAAAAAB...",
url="https://example.com",
)
print(result.token)
asyncio.run(main())
Error Handling
from nslsolver import (
NSLSolver,
AuthenticationError,
InsufficientBalanceError,
RateLimitError,
SolveError,
NSLSolverError,
)
solver = NSLSolver("your-api-key")
try:
result = solver.solve_turnstile(
site_key="0x4AAAAAAAB...",
url="https://example.com",
)
except AuthenticationError:
print("Bad API key.")
except InsufficientBalanceError:
print("Top up your balance.")
except RateLimitError:
print("Rate limited after all retries.")
except SolveError as e:
print(f"Solve failed: {e.message}")
except NSLSolverError as e:
print(f"API error (HTTP {e.status_code}): {e.message}")
Rate-limit (429) and backend (503) errors are retried automatically with exponential backoff before raising.
Configuration
solver = NSLSolver(
api_key="your-api-key",
base_url="https://api.nslsolver.com", # default
timeout=120, # seconds (default: 120)
max_retries=3, # retries for 429/503 (default: 3)
)
Both clients support context managers (with / async with) for session cleanup.
Requirements
- Python 3.8+
requests(sync client)aiohttp(async client, optional)
Documentation
For more information, check out the full documentation at https://docs.nslsolver.com
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nslsolver-1.0.1.tar.gz.
File metadata
- Download URL: nslsolver-1.0.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c05940ac8662e65a40d3c6b55099be0639618dd60ad875fc4dbfe817ab2ca171
|
|
| MD5 |
e1a4d4788f2d667b72e7733f2acc8a6e
|
|
| BLAKE2b-256 |
d0a5e74262f1e699e5923e4193bec28e4efe76216569123f808d9f7767383e0c
|
File details
Details for the file nslsolver-1.0.1-py3-none-any.whl.
File metadata
- Download URL: nslsolver-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f1ced5313766fbbc742e3aa4b30c6b2f67d088af4c0b3a39a652c97daee5cda
|
|
| MD5 |
29ee133ea0ff765c986ab35378b10c6c
|
|
| BLAKE2b-256 |
c2fc493753476df518a7b2b13042aee8d13f7662794afa540befca76c564dfc9
|