asyncakinator
An async API wrapper for the online game, Akinator, written in Python.
Akinator is a web-based game which tries to determine what character you are thinking of by asking a series of questions.
Installing
To install, just run the following command:
# MacOS/Linux
python3 -m pip install -U asyncakinator
# Windows
py -3 -m pip install -U asyncakinator
Requirements
Python ≥3.9
aiohttp
Documentation
Documention can be found here.
Quick Examples
Here’s a quick little example of the library being used to make a simple, text-based Akinator game:
import asyncio
from asyncakinator import (
Akinator,
Answer,
CanNotGoBack,
InvalidAnswer,
Language,
NoMoreQuestions,
Theme
)
game = Akinator(
language=Language.ENGLISH,
theme=Theme.ANIMALS,
)
async def main():
question = await game.start()
while game.progression <= 80:
print(question)
user_input = input("Answer: ")
try:
answer = Answer.from_str(user_input)
except InvalidAnswer:
print("Invalid answer")
continue
try:
question = await game.answer(answer)
except CanNotGoBack:
print("This is the first question, you can't go back.")
continue
except NoMoreQuestions:
break
await game.win()
correct = input(
f"You are thinking of {game.first_guess.name} ({game.first_guess.description}). "
f"Am I correct?\n{game.first_guess.absolute_picture_path}\n---\nAnswer: "
)
if Answer.from_str(correct) == Answer.YES:
print("Nice.")
else:
print("Maybe next time.")
await game.close()
asyncio.run(main())
Metadata
Release files for asyncakinator 1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asyncakinator-1.7.tar.gz | 14.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asyncakinator-1.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.7 kB
Release files / asyncakinator-1.7.tar.gz
| Download URL | asyncakinator-1.7.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c83de25b5b17c5c31b8f21fd65dc63fabca0357b36ecde4757d7fc5abefd202
|
|
BLAKE2b-256 checksum How to use checksums |
3bd30bcdab1fa19b1e52100be370c722e167a2e62e14fef603f08c2c72a11508
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / asyncakinator-1.7-py3-none-any.whl
| Download URL | asyncakinator-1.7-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2ecd9e70f2c069eaae9a4580d733158d08d3fe807e51d223ebd651f0bfbce99
|
|
BLAKE2b-256 checksum How to use checksums |
85654f30d427bdb4c4472384d9a0fde97ef98538c6457004565eb62041873fee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|