Skip to main content

A Python library wrapper for Akinator

Project description

akipy [WIP]

Python library wrapper for akinator.com

Wrapper is still in development. Some things are not present or partially present.

Such as,

  • Exception Handling
  • Docs
  • Better error Handling
  • Custom Exceptions
  • Support for Choice and Exclusion, once Akinator makes a proposal

These are the things I'll be working on trying to improve. 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.0.tar.gz (7.6 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.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for akipy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2819def0b03ce527920efee46b7ecb7734accc0c56728d9ca652d941f9722b9a
MD5 33d1a6f04629ffc2261c61613280408f
BLAKE2b-256 f492eb70e04eff83e8899cff743f6f299fa5663c7bc62f03de7611efdb605173

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for akipy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e8506fe62a3322cad1c2a1bb6afea64c10477c6fb55583c8418523d44da6477
MD5 320ce73d8b1a2a2bdcca3162d6660718
BLAKE2b-256 24ff39bb31af4e2f8fa46f6cd156235e8c39a6219a5dc5b2ede46c840f1435ab

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