Skip to main content

An async API wrapper for Akinator, written in Python.

Project description

An async API wrapper for the online game, Akinator, written in Python

https://img.shields.io/badge/python-%E2%89%A53.5.3-yellow.svg

Copyright © 2019 NinjaSnail1080

Copyright © 2022 avizum

Licensed under the MIT License (see LICENSE.txt for details).

Akinator.com is an online game where you think of a character, real or fiction, and by asking you questions the site will try to guess who you’re thinking of. This library allows for easy access to the Akinator API and makes writing programs that use it much simpler.


Installing

To install, just run the following command:

python3 -m pip install -U asyncakinator

Requirements

  • Python ≥3.9

  • requests

  • aiohttp

Usually, pip will handle these for you.

Quick Examples

Here’s a quick little example of the library being used to make a simple, text-based Akinator game:

import akinator
import asyncio

aki = akinator.AsyncAkinator()

async def main():
    q = await aki.start()

    while aki.progression <= 80:
        a = input(q + "\n\t")
        if a == "b":
            try:
                q = await aki.back()
            except akinator.CantGoBackAnyFurther:
                pass
        else:
            q = await aki.answer(a)
    await aki.win()

    correct = input(f"It's {aki.first_guess['name']} ({aki.first_guess['description']})! Was I correct?\n{aki.first_guess['absolute_picture_path']}\n\t")
    if correct.lower() == "yes" or correct.lower() == "y":
        print("Yay\n")
    else:
        print("Oof\n")
    await aki.close()

await asyncio.run(main())

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

asyncakinator-1.0.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

asyncakinator-1.0.2-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file asyncakinator-1.0.2.tar.gz.

File metadata

  • Download URL: asyncakinator-1.0.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for asyncakinator-1.0.2.tar.gz
Algorithm Hash digest
SHA256 60c6b95975adb866f24eb9a4faf89a5d8cfe8e2b552bd5b23da92e5e8db16155
MD5 ae35eb62bea113f89a5b8b3a5e0b75c9
BLAKE2b-256 487798f1559df8dcac74a37af48a20716e645f65a0cd8d8136a9c03641c0a662

See more details on using hashes here.

File details

Details for the file asyncakinator-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for asyncakinator-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 caadc68d6c5cd39f69977abf3de240f4639b15f8ba50d9c2bf56091e2009047a
MD5 7fb82581ad369c7da93bb12b9bdbbd53
BLAKE2b-256 e18e616fbb7aaaf193c8b8078f72a69d6b7f031b0595d017127e09091243e7b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page