A Python library for solving riddles using repixify.com API
Project description
Riddles Solver
🧩 A Python library for solving riddles using repixify.com API
✨ Features
- 🔄 Synchronous and asynchronous API
- 🔑 Automatic key extraction
- 🎭 Random User-Agent support
- 🚀 Easy to use
📦 Installation
pip install riddles-solver
# Install all dependencies
playwright install
Optional dependencies
# For asynchronous client
pip install riddles-solver[async]
# For User-Agent generation
pip install riddles-solver[user-agent]
# For development
pip install riddles-solver[dev]
🚀 Quick Start
1. Getting a key
import riddles_solver
# Automatic key extraction
key = riddles_solver.get_key()
print(f"Your key: {key}")
2. Solving riddles (synchronous)
import riddles_solver
# Create client
client = riddles_solver.Client(key="a1b2c3d4e5f6789012345678901234567890abcdef")
# Solve riddles
answer = client.solve("2+2")
print(answer) # 4
answer = client.solve("What has keys but no locks?")
print(answer) # Piano
3. Asynchronous riddle solving
import asyncio
import riddles_solver
async def main():
# Create asynchronous client
async with riddles_solver.AsyncClient(key="a1b2c3d4e5f6789012345678901234567890abcdef") as client:
# Solve one riddle
answer = await client.solve("2+2")
print(answer)
# Solve multiple riddles in parallel
riddles = ["2+2", "2+2*2", "What is the capital of France?"]
answers = await client.solve_batch(riddles)
for riddle, answer in zip(riddles, answers):
print(f"{riddle} = {answer}")
asyncio.run(main())
📖 Documentation
Synchronous client
# Basic usage
client = riddles_solver.Client(key="your_key")
# With custom User-Agent
client = riddles_solver.Client(
key="your_key",
user_agent="Custom User Agent"
)
# Solve riddle
answer = client.solve("your riddle")
Asynchronous client
# Create client
async_client = riddles_solver.AsyncClient(key="your_key")
# Solve one riddle
answer = await async_client.solve("riddle")
# Batch solving
riddles = ["riddle1", "riddle2", "riddle3"]
answers = await async_client.solve_batch(riddles)
# Don't forget to close the session
await async_client.close()
# Or use context manager
async with riddles_solver.AsyncClient(key="your_key") as client:
answer = await client.solve("riddle")
Getting keys
# Programmatically
key = riddles_solver.get_key()
# Via CLI
# riddles-get-key
🛠️ CLI
After installation, a command-line utility is available:
# Get a new key
riddles-get-key
# Or
python -m riddles_solver.cli
📋 Complete example
import asyncio
import riddles_solver
async def demo():
print("🔑 Getting key...")
key = riddles_solver.get_key()
if not key:
print("❌ Failed to get key")
return
print(f"✅ Key obtained: {key}")
# Synchronous client
print("\n🔄 Synchronous solving:")
sync_client = riddles_solver.Client(key=key)
answer = sync_client.solve("2+2")
print(f"2+2 = {answer}")
# Asynchronous client
print("\n⚡ Asynchronous solving:")
async with riddles_solver.AsyncClient(key=key) as async_client:
riddles = ["2+2*2", "What is the capital of Russia?", "10-5"]
answers = await async_client.solve_batch(riddles)
for riddle, answer in zip(riddles, answers):
print(f"{riddle} = {answer}")
if __name__ == "__main__":
asyncio.run(demo())
🧪 Testing
# Run tests
pytest
# With coverage
pytest --cov=riddles_solver
🤝 Development
# Clone repository
git clone https://github.com/Towux/riddles_solver.git
cd riddles_solver
# Install in development mode
pip install -e .[dev]
# Code formatting
black riddles_solver/
# Type checking
mypy riddles_solver/
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙋♂️ Support
If you have questions or issues:
- Check Issues
- Create a new Issue if you don't find a solution
- Describe the problem in as much detail as possible
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
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 riddles_solver-1.0.0.tar.gz.
File metadata
- Download URL: riddles_solver-1.0.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02776c383163d7405511ace90284243ac1294213fd72fce6495a9cd6785ebeac
|
|
| MD5 |
6ee43ba9fb26aff08d850622471d1548
|
|
| BLAKE2b-256 |
c07f9de5a4655656011c467e9a332f4f2f7102909627fd849fb2ccf36d5b1603
|
File details
Details for the file riddles_solver-1.0.0-py3-none-any.whl.
File metadata
- Download URL: riddles_solver-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8560912c7c6db3df1f1f8c2d8393517c14527203709d2e6cb472ec04aa8e463
|
|
| MD5 |
7f65b5e46a192d52181b473ea4d23191
|
|
| BLAKE2b-256 |
e5454c9b4674b8a4cec84745d7bc44a5b88b6aa609c671f28016bca3cb0921a1
|