An async Python client for the RoSolve API
Project description
RoSolve
An async Python client for the RoSolve API, supporting FunCaptcha solving for Roblox.
Features
- ✨ Async-first design
- 📝 Type hints for better IDE support
- 🎮 Clean.
- 💻 Cross-platform support (Windows, macOS, Linux)
- 🔄 Automatic retries and error handling
- 🚀 Easy to use with proper session management
Installation
pip install rosolve
Quick Start
import asyncio
from rosolve import Client
async def main():
async with Client("your_api_key") as client:
# Get balance
balance = await client.get_balance()
print(f"Current balance: {balance}")
if __name__ == "__main__":
asyncio.run(main())
FunCaptcha Solving Example
Here's a complete example of solving a FunCaptcha challenge:
import asyncio
from curl_cffi import requests
from rosolve import Client
async def main():
# Initialize your Roblox session
roblox_session = requests.Session()
roblox_session.headers.update({
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/122.0.0.0",
"sec-ch-ua": '"Chromium";v="122", "Google Chrome";v="122"'
})
# Your configuration
api_key = "your_api_key_here"
cookie = ".ROBLOSECURITY=your_cookie_here"
proxy = "http://user:pass@host:port"
blob = "your_blob_data_here" # From Roblox challenge
async with Client(api_key) as client:
try:
# Solve the FunCaptcha
solution = await client.solve_funcaptcha(
roblox_session=roblox_session,
blob=blob,
proxy=proxy,
cookie=cookie
)
if solution:
print("Successfully solved captcha!")
print(f"Token: {solution}")
else:
print("Failed to solve captcha")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
asyncio.run(main())
API Reference
Client
The main class for interacting with the RoSolve API.
client = Client(api_key: str, session: Optional[aiohttp.ClientSession] = None)
Parameters:
api_key
(str): Your RoSolve API keysession
(Optional[aiohttp.ClientSession]): An optional aiohttp session to use
Methods
get_balance()
Get your current RoSolve balance.
balance = await client.get_balance()
Returns:
float
: Your current balance
Raises:
InvalidKey
: If the API key is invalid
solve_funcaptcha()
Solve a FunCaptcha challenge.
solution = await client.solve_funcaptcha(
roblox_session: requests.Session,
blob: str,
proxy: str,
cookie: str,
max_retries: int = 60,
retry_delay: float = 1.0
)
Parameters:
roblox_session
(requests.Session): The Roblox session objectblob
(str): The blob data from the challengeproxy
(str): Proxy to use (format: "protocol://user:pass@host:port")cookie
(str): Roblox cookiemax_retries
(int, optional): Maximum retries for checking solution. Defaults to 60retry_delay
(float, optional): Delay between retries in seconds. Defaults to 1.0
Returns:
Optional[str]
: The solution token if successful, None if failed
Raises:
TaskError
: If the task creation fails
Error Handling
The package provides several custom exceptions:
from rosolve import RoSolveException, InvalidKey, TaskError
try:
solution = await client.solve_funcaptcha(...)
except InvalidKey:
print("Invalid API key")
except TaskError as e:
print(f"Task failed: {e}")
except RoSolveException as e:
print(f"General error: {e}")
Best Practices
- Always use the client as a context manager:
async with Client(api_key) as client:
# Your code here
- Check your balance before heavy usage:
balance = await client.get_balance()
if balance < 10:
print("Low balance warning!")
- Handle exceptions appropriately:
try:
solution = await client.solve_funcaptcha(...)
except Exception as e:
print(f"Error: {e}")
- Use proper proxy formatting:
# With authentication
proxy = "http://username:password@host:port"
# Without authentication
proxy = "http://host:port"
License
This project is licensed under the UnLicense - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file rosolve-1.0.0.tar.gz
.
File metadata
- Download URL: rosolve-1.0.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80bb72971407ec363d135756c0ffdbad2822ca57753d4d249d0d9e9c32009ea3 |
|
MD5 | 33460449d7c880468ad729dea2513d5b |
|
BLAKE2b-256 | 5fcb284e0ed55fd7ae4d0e67adc7a45dd3281071e3cd6f7b2e187a06800850c0 |
File details
Details for the file rosolve-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: rosolve-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83ded810894529aa85ddfb208f8f14a36a7561e57bb0838ab3a66b773a66057d |
|
MD5 | 782f42154fcf20015e46a8d891bd9114 |
|
BLAKE2b-256 | 42f00b2b3cfeffaf0664663634e138ed071032fd2bc8f7f4d4a196c7e62abcd1 |