a python api wrapper for akinator's guesssing game api.
Project description
rynaki
An unofficial, robust, and asynchronous-friendly Python API wrapper for the popular online game Akinator.
rynaki is designed to be simple and intuitive, allowing developers to easily integrate the Akinator game into their own applications. It is built on top of cloudscraper to handle Cloudflare's anti-bot protection, ensuring reliable communication with the Akinator servers.
Features
- Asynchronous Support: Built with
asyncioin mind for high-performance applications. - Theme Selection: Supports
characters,objects, andanimalsthemes. - Full Game Control: Includes functions to start games, answer questions, go back, and handle guesses.
- Cloudflare Bypass: Uses
cloudscraperto seamlessly bypass Cloudflare's IUAM challenges. - Robust Error Handling: Custom exceptions for clear and predictable error management.
Documentation
For a complete guide, including detailed class and method references, please visit the official documentation:
Installation
Install rynaki easily using pip:
pip install rynaki
Quickstart
Here is a simple example of how to use rynaki in an asynchronous application:
import asyncio
from rynaki import Akinator, AkinatorError
async def main():
try:
# Initialize the game in English with the 'characters' theme
aki = Akinator(theme="characters", lang="en")
# Start the game and get the first question
question = await asyncio.to_thread(aki.start_game)
print(f"First Question: {question}")
# --- Game Loop ---
while aki.name is None: # Loop until Akinator makes a guess
answer = input("Your answer (y/n/idk/p/pn): ").lower()
if answer == "stop":
break
# Post the answer and get the next question
question = await asyncio.to_thread(aki.post_answer, answer)
print(f"Next Question ({aki.progression:.2f}%): {question}")
# --- Guess ---
if aki.name:
print("\n--- Akinator's Guess ---")
print(f"Character: {aki.name}")
print(f"Description: {aki.description}")
if aki.photo:
print(f"Photo: {aki.photo}")
correct = input("Is this correct? (y/n): ").lower()
if correct == 'y':
print("Yay! I guessed it right!")
else:
print("Oh, you defeated me!")
except AkinatorError as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
asyncio.run(main())
Contributing
Contributions are welcome! If you find a bug, have a feature request, or want to improve the code, please feel free to open an issue or submit a pull request on the project's GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
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 rynaki-0.1.3.tar.gz.
File metadata
- Download URL: rynaki-0.1.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbc174b04f91a41f527c9968da6dd6da4a64bbd42b6abd1d9b715e15a34e82cc
|
|
| MD5 |
e23fd44bd7e4006a775bff6ccfe06d92
|
|
| BLAKE2b-256 |
5622166a1b7942e2e075f40c1d77e04d4c421b833619b1424a09d572169be380
|
File details
Details for the file rynaki-0.1.3-py3-none-any.whl.
File metadata
- Download URL: rynaki-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
872ae26e1e8fec5aa34e98c11575e84bb87c66ef98f52d3be2608e3cdf3d2605
|
|
| MD5 |
ffa59c2f36176a40e40af8671359335d
|
|
| BLAKE2b-256 |
8ca06b67b11cefac94b1b39ffc43b0e7bf8573bd9f573a3a55fc80c470e19ac2
|