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.3.tar.gz (9.5 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.3-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: akipy-0.2.3.tar.gz
  • Upload date:
  • Size: 9.5 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.3.tar.gz
Algorithm Hash digest
SHA256 3a9aaa5a5634f128b583afa63490c17005230e3da388d162bd59860c00dda11b
MD5 0e83a1abc47717fcff3b909f3eb28d21
BLAKE2b-256 1cdf16f199a31a3f140f16c1655db886e077e1fc6514a8efd73d6ea847bf4e57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: akipy-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.3 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cb79a00e5c8affb985d1114956084860dd20ebb8e7ed63f62b1d180dae66c0cb
MD5 31d2a65a0287c17fa36b31feb71c13b9
BLAKE2b-256 78e098883bf71a7946a91213afe4a15b3807f35cc5954fcfb964b92c52e5360e

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