animeapi-py


Nameanimeapi-py JSON
Version 3.7.0 PyPI version JSON
download
home_pageNone
SummaryA Python wrapper for the AnimeAPI by nattadasu with type hints and additional async support.
upload_time2025-10-19 10:00:39
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseAGPL-3.0-or-later
keywords anime api wrapper async python animeapi nattadasu relations mappings type hints type annotations
VCS
bugtrack_url
requirements aiohttp dacite requests typing_extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            AnimeAPI Python Wrapper
=======================

animeapi-python is a Python wrapper for the
`AnimeAPI <https://animeapi.my.id>`__ made by
`nattadasu <https://github.com/nattadasu>`__.

The wrapper is released with type hints and async support in mind for
ease of use and is compatible with Python 3.7 or higher.

Installation
------------

.. code:: sh

   pip install animeapi-py

Depending on your system, you may need to use ``pip3`` instead of
``pip``, or ``sudo pip`` instead of ``pip``.

Requirements
~~~~~~~~~~~~

-  Python 3.7 or higher
-  `aiohttp <https://pypi.org/project/aiohttp/>`__ (for async support)
-  `dacite <https://pypi.org/project/dacite/>`__
-  `requests <https://pypi.org/project/requests/>`__
-  `typing_extensions <https://pypi.org/project/typing-extensions/>`__ (for Python <= 3.8)

Usage
-----

.. code:: py

   import animeapi

   with animeapi.AnimeAPI() as api:
       # Get anime relation data for the anime with ID 1 on MyAnimeList
       mal = api.get_anime_relations(1, animeapi.Platform.MYANIMELIST)
       print(mal)

       # Get list of anime available on AniList
       anilist = api.get_list_anime_relations(animeapi.Platform.ANILIST)
       print(anilist[:2])  # Print first two results

       # Get dictionary of anime available on Kitsu
       kitsu = api.get_dict_anime_relations(animeapi.Platform.KITSU)
       print(kitsu['1'])  # Print data for Cowboy Bebop

We recommend using the ``with`` statement to create an instance of
``AnimeAPI`` as we designed the wrapper to be easy to switch between
sync and async, although you can also use ``AnimeAPI`` directly on
``sync`` methods only.

Asyncronous Usage
~~~~~~~~~~~~~~~~~

Similarly, for async, you just need to replace ``AnimeAPI`` with
``AsyncAnimeAPI`` and use ``await`` on the methods.

You must use the wrapper in ``with`` statement, or you will receive
``RuntimeError`` exception.

.. code:: py

   import asyncio
   import animeapi

   async def main():
       async with animeapi.AsyncAnimeAPI() as api:
           # Get anime relation data for the anime with ID 1 on MyAnimeList
           mal = await api.get_anime_relations(1, animeapi.Platform.MYANIMELIST)
           print(mal)

           # Get list of anime available on AniList
           anilist = await api.get_list_anime_relations(animeapi.Platform.ANILIST)
           print(anilist[:2])  # Print first two results

           # Get dictionary of anime available on Kitsu
           kitsu = await api.get_dict_anime_relations(animeapi.Platform.KITSU)
           print(kitsu['1'])  # Print data for Cowboy Bebop

   if __name__ == "__main__":
       asyncio.run(main())

Documentation
-------------

You can find the documentation for the wrapper `here <https://animeapi-py.readthedocs.io/en/latest/>`__

Available Methods
~~~~~~~~~~~~~~~~~

``get_anime_relations(title_id: str | int, platform: str | Platform, media_type: str | TraktMediaType | TmdbMediaType | None = None, title_season: int | None) -> AnimeRelation``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This method equals to the ``/:platform/:title_id`` endpoint on the API.

.. code:: py

   # Get anime relation data for the anime with ID 1 on MyAnimeList
   mal = api.get_anime_relations(1, animeapi.Platform.MYANIMELIST)
   print(mal)

   # Get anime relation data for Trakt shows with season
   trakt = api.get_anime_relations(152334, animeapi.Platform.TRAKT, 
                                    media_type=animeapi.TraktMediaType.SHOWS, 
                                    title_season=3)
   print(trakt)

   # Get anime relation data for TMDB TV shows
   tmdb = api.get_anime_relations(12345, animeapi.Platform.THEMOVIEDB,
                                   media_type=animeapi.TmdbMediaType.TV)
   print(tmdb)

   # Get anime relation data for The TVDB with season
   tvdb = api.get_anime_relations(76885, animeapi.Platform.THETVDB,
                                   title_season=1)
   print(tvdb)

``get_dict_anime_relations(platform: str | Platform) -> dict[str, AnimeRelation]``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This method equals to the ``/:platform`` endpoint on the API. Use this
method if you want to get complete data for all anime available on a
platform and wanted to be able to access the data by the anime ID
faster.

.. code:: py

   # Get dictionary of anime available on Kitsu
   kitsu = api.get_dict_anime_relations(animeapi.Platform.KITSU)
   print(kitsu['1'])  # Print data for Cowboy Bebop

``get_list_anime_relations(platform: str | Platform) -> list[AnimeRelation]``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This method equals to the ``/:platform()`` endpoint on the API.

.. code:: py

   # Get list of anime available on AniList
   anilist = api.get_list_anime_relations(animeapi.Platform.ANILIST)
   print(anilist[:2])  # Print first two results

``get_list_index() -> list[AnimeRelation]``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This method equals to the ``/animeapi`` endpoint on the API.

.. code:: py

   # Get list of anime available on AnimeAPI
   animeapi_list = api.get_list_index()
   print(animeapi_list[:2])  # Print first two results

``get_status() -> ApiStatus``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This method equals to the ``/status`` endpoint on the API.

.. code:: py

   # Get status of AnimeAPI
   status = api.get_status()
   print(status)

``get_heartbeat() -> Heartbeat``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This method equals to the ``/heartbeat`` endpoint on the API.

.. code:: py

   # Get heartbeat of AnimeAPI
   heartbeat = api.get_heartbeat()
   print(heartbeat)

``get_updated_time() -> Updated``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This method equals to the ``/updated`` endpoint on the API.

.. code:: py

   # Get last updated time of AnimeAPI
   updated = api.get_updated_time()
   print(updated)
   print(updated.datetime())  # Convert to datetime class

License
-------

``animeapi-py`` is licensed under the `GNU Affero General Public License
v3.0 <LICENSE>`__.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "animeapi-py",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "anime, api, wrapper, async, python, animeapi, nattadasu, relations, mappings, type hints, type annotations",
    "author": null,
    "author_email": "nattadasu <hello@nattadasu.my.id>",
    "download_url": "https://files.pythonhosted.org/packages/b4/46/3d2107d276f32d495510b1a37475bd0c655a87bbb0b3f7cb8e34cad24789/animeapi_py-3.7.0.tar.gz",
    "platform": null,
    "description": "AnimeAPI Python Wrapper\n=======================\n\nanimeapi-python is a Python wrapper for the\n`AnimeAPI <https://animeapi.my.id>`__ made by\n`nattadasu <https://github.com/nattadasu>`__.\n\nThe wrapper is released with type hints and async support in mind for\nease of use and is compatible with Python 3.7 or higher.\n\nInstallation\n------------\n\n.. code:: sh\n\n   pip install animeapi-py\n\nDepending on your system, you may need to use ``pip3`` instead of\n``pip``, or ``sudo pip`` instead of ``pip``.\n\nRequirements\n~~~~~~~~~~~~\n\n-  Python 3.7 or higher\n-  `aiohttp <https://pypi.org/project/aiohttp/>`__ (for async support)\n-  `dacite <https://pypi.org/project/dacite/>`__\n-  `requests <https://pypi.org/project/requests/>`__\n-  `typing_extensions <https://pypi.org/project/typing-extensions/>`__ (for Python <= 3.8)\n\nUsage\n-----\n\n.. code:: py\n\n   import animeapi\n\n   with animeapi.AnimeAPI() as api:\n       # Get anime relation data for the anime with ID 1 on MyAnimeList\n       mal = api.get_anime_relations(1, animeapi.Platform.MYANIMELIST)\n       print(mal)\n\n       # Get list of anime available on AniList\n       anilist = api.get_list_anime_relations(animeapi.Platform.ANILIST)\n       print(anilist[:2])  # Print first two results\n\n       # Get dictionary of anime available on Kitsu\n       kitsu = api.get_dict_anime_relations(animeapi.Platform.KITSU)\n       print(kitsu['1'])  # Print data for Cowboy Bebop\n\nWe recommend using the ``with`` statement to create an instance of\n``AnimeAPI`` as we designed the wrapper to be easy to switch between\nsync and async, although you can also use ``AnimeAPI`` directly on\n``sync`` methods only.\n\nAsyncronous Usage\n~~~~~~~~~~~~~~~~~\n\nSimilarly, for async, you just need to replace ``AnimeAPI`` with\n``AsyncAnimeAPI`` and use ``await`` on the methods.\n\nYou must use the wrapper in ``with`` statement, or you will receive\n``RuntimeError`` exception.\n\n.. code:: py\n\n   import asyncio\n   import animeapi\n\n   async def main():\n       async with animeapi.AsyncAnimeAPI() as api:\n           # Get anime relation data for the anime with ID 1 on MyAnimeList\n           mal = await api.get_anime_relations(1, animeapi.Platform.MYANIMELIST)\n           print(mal)\n\n           # Get list of anime available on AniList\n           anilist = await api.get_list_anime_relations(animeapi.Platform.ANILIST)\n           print(anilist[:2])  # Print first two results\n\n           # Get dictionary of anime available on Kitsu\n           kitsu = await api.get_dict_anime_relations(animeapi.Platform.KITSU)\n           print(kitsu['1'])  # Print data for Cowboy Bebop\n\n   if __name__ == \"__main__\":\n       asyncio.run(main())\n\nDocumentation\n-------------\n\nYou can find the documentation for the wrapper `here <https://animeapi-py.readthedocs.io/en/latest/>`__\n\nAvailable Methods\n~~~~~~~~~~~~~~~~~\n\n``get_anime_relations(title_id: str | int, platform: str | Platform, media_type: str | TraktMediaType | TmdbMediaType | None = None, title_season: int | None) -> AnimeRelation``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis method equals to the ``/:platform/:title_id`` endpoint on the API.\n\n.. code:: py\n\n   # Get anime relation data for the anime with ID 1 on MyAnimeList\n   mal = api.get_anime_relations(1, animeapi.Platform.MYANIMELIST)\n   print(mal)\n\n   # Get anime relation data for Trakt shows with season\n   trakt = api.get_anime_relations(152334, animeapi.Platform.TRAKT, \n                                    media_type=animeapi.TraktMediaType.SHOWS, \n                                    title_season=3)\n   print(trakt)\n\n   # Get anime relation data for TMDB TV shows\n   tmdb = api.get_anime_relations(12345, animeapi.Platform.THEMOVIEDB,\n                                   media_type=animeapi.TmdbMediaType.TV)\n   print(tmdb)\n\n   # Get anime relation data for The TVDB with season\n   tvdb = api.get_anime_relations(76885, animeapi.Platform.THETVDB,\n                                   title_season=1)\n   print(tvdb)\n\n``get_dict_anime_relations(platform: str | Platform) -> dict[str, AnimeRelation]``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis method equals to the ``/:platform`` endpoint on the API. Use this\nmethod if you want to get complete data for all anime available on a\nplatform and wanted to be able to access the data by the anime ID\nfaster.\n\n.. code:: py\n\n   # Get dictionary of anime available on Kitsu\n   kitsu = api.get_dict_anime_relations(animeapi.Platform.KITSU)\n   print(kitsu['1'])  # Print data for Cowboy Bebop\n\n``get_list_anime_relations(platform: str | Platform) -> list[AnimeRelation]``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis method equals to the ``/:platform()`` endpoint on the API.\n\n.. code:: py\n\n   # Get list of anime available on AniList\n   anilist = api.get_list_anime_relations(animeapi.Platform.ANILIST)\n   print(anilist[:2])  # Print first two results\n\n``get_list_index() -> list[AnimeRelation]``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis method equals to the ``/animeapi`` endpoint on the API.\n\n.. code:: py\n\n   # Get list of anime available on AnimeAPI\n   animeapi_list = api.get_list_index()\n   print(animeapi_list[:2])  # Print first two results\n\n``get_status() -> ApiStatus``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis method equals to the ``/status`` endpoint on the API.\n\n.. code:: py\n\n   # Get status of AnimeAPI\n   status = api.get_status()\n   print(status)\n\n``get_heartbeat() -> Heartbeat``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis method equals to the ``/heartbeat`` endpoint on the API.\n\n.. code:: py\n\n   # Get heartbeat of AnimeAPI\n   heartbeat = api.get_heartbeat()\n   print(heartbeat)\n\n``get_updated_time() -> Updated``\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis method equals to the ``/updated`` endpoint on the API.\n\n.. code:: py\n\n   # Get last updated time of AnimeAPI\n   updated = api.get_updated_time()\n   print(updated)\n   print(updated.datetime())  # Convert to datetime class\n\nLicense\n-------\n\n``animeapi-py`` is licensed under the `GNU Affero General Public License\nv3.0 <LICENSE>`__.\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0-or-later",
    "summary": "A Python wrapper for the AnimeAPI by nattadasu with type hints and additional async support.",
    "version": "3.7.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/nattadasu/animeapi-py/issues",
        "Homepage": "https://animeapi.my.id",
        "Source": "https://github.com/nattadasu/animeapi-py"
    },
    "split_keywords": [
        "anime",
        " api",
        " wrapper",
        " async",
        " python",
        " animeapi",
        " nattadasu",
        " relations",
        " mappings",
        " type hints",
        " type annotations"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3743c529fef52e23ab40ffe6e86d63887802cc0bf6065f39252bee07dae9e487",
                "md5": "1a89f84d5bc461377de975edff8631f2",
                "sha256": "dc5a7c2c32d306f12fd338d58d8fd5ebf92a9520d9587dc663f0a4e317e1adcc"
            },
            "downloads": -1,
            "filename": "animeapi_py-3.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1a89f84d5bc461377de975edff8631f2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 25538,
            "upload_time": "2025-10-19T10:00:37",
            "upload_time_iso_8601": "2025-10-19T10:00:37.906014Z",
            "url": "https://files.pythonhosted.org/packages/37/43/c529fef52e23ab40ffe6e86d63887802cc0bf6065f39252bee07dae9e487/animeapi_py-3.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b4463d2107d276f32d495510b1a37475bd0c655a87bbb0b3f7cb8e34cad24789",
                "md5": "f548e4a57304f6595e2fe7d05fe69031",
                "sha256": "4071db9ca04dea3782751bd62d01be1bf1524cfad30f3e6d83a2da4a8fc4c08f"
            },
            "downloads": -1,
            "filename": "animeapi_py-3.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f548e4a57304f6595e2fe7d05fe69031",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 24178,
            "upload_time": "2025-10-19T10:00:39",
            "upload_time_iso_8601": "2025-10-19T10:00:39.140132Z",
            "url": "https://files.pythonhosted.org/packages/b4/46/3d2107d276f32d495510b1a37475bd0c655a87bbb0b3f7cb8e34cad24789/animeapi_py-3.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-19 10:00:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nattadasu",
    "github_project": "animeapi-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": []
        },
        {
            "name": "dacite",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "typing_extensions",
            "specs": []
        }
    ],
    "lcname": "animeapi-py"
}
        
Elapsed time: 0.77402s