Skip to main content

A Python library wrapper for Akinator

Project description

akipy

Python library wrapper for akinator.com You can use this in your python projects to integrate Akinator functionalities.

Wrapper is still in development. Some things may or may not work. If you experience issues, feel free to raise an issue here.

Some things that could be improved:

  • Exception Handling
  • Docs
  • Better error Handling
  • Custom Exceptions

If you want to help, the above is the main priority for now.

Why ?

I already used to use a wrapper library for Akinator (akinator.py) before. But suddenly it seems to be not working. I debugged and made sure the problem is because of API changes from Akinator themselves. There were so many changes making me think I would have to change a lot of things. So instead of doing that, I just made it from scratch. Obviously I took a lot of inspiration from the old Python wrapper I was using thus the code structure would look very similar. In fact, I'm trying to replicate the same interface that was present in the old wrapper. Because I don't want to make changes to any piece of software that may depend on this library (which isn't working now).

I hope there isn't any interface breaking changes here. If there are any, please contact me either through Telegram or raise an issue here on GitHub or if you want to help, raise a Pull Request.

Installation

pip install akipy

Usage

There is both synchronous and asynchronous variants of akipy available.

Synchronous: from akipy import Akinator

Asynchronous: from akipy.async_akipy import Akinator

I'll provide a sample usage for synchronous usage of Akinator. All the examples are also in the project's examples folder. So please check them out as well.

import akipy

aki = akipy.Akinator()
aki.start_game()

while not aki.win:
    ans = input(str(aki) + "\n\t")
    if ans == "b":
        try:
            aki.back()
        except akipy.CantGoBackAnyFurther:
            pass
    else:
        try:
            aki.answer(ans)
        except akipy.InvalidChoiceError:
            pass

print(aki)
print(aki.name_proposition)
print(aki.description_proposition)
print(aki.pseudo)
print(aki.photo)

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

akipy-0.2.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

akipy-0.2.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file akipy-0.2.1.tar.gz.

File metadata

  • Download URL: akipy-0.2.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.2 CPython/3.12.3 Linux/6.8.0-1020-azure

File hashes

Hashes for akipy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4f898c66234efca7f5cddc5111ddfe891eb05e08b5ab773d5bbb6448eef2cb29
MD5 6cf7af729cdeba85a132af757ca703a4
BLAKE2b-256 7d26c22707c2115736cf7bd7f4e1b6bc1f0af6a2ffcfd18a7128a3ebe0a1463c

See more details on using hashes here.

File details

Details for the file akipy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: akipy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.2 CPython/3.12.3 Linux/6.8.0-1020-azure

File hashes

Hashes for akipy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd084fe2ebe6bcdc9a5b012ce1a3f6881e3811f9e8aebcfbf80fd19b9b3f357b
MD5 c226a2db208072514de2a3388a18b218
BLAKE2b-256 3b21c38facedd14c3436b342861cbb4690186f6774318f317a87671359cf32ad

See more details on using hashes here.

Supported by

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