jikanpy-v4


Namejikanpy-v4 JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/abhinavk99/jikanpy
SummaryPython wrapper for the Jikan API
upload_time2023-04-02 21:31:01
maintainer
docs_urlNone
authorChris Peterson
requires_python>=3.6
licenseMIT
keywords jikan jikanpy api myanimelist
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            # JikanPy

[![Travis (.com)](https://img.shields.io/travis/com/abhinavk99/jikanpy?style=flat-square)](https://travis-ci.com/abhinavk99/jikanpy)
[![Codecov](https://img.shields.io/codecov/c/github/abhinavk99/jikanpy.svg?style=flat-square)](https://codecov.io/gh/abhinavk99/jikanpy/)
[![pypi Version](https://img.shields.io/pypi/v/jikanpy-v4.svg?style=flat-square)](https://pypi.org/project/jikanpy-v4/)
[![PyPi downloads](https://img.shields.io/pypi/dm/jikanpy-v4?style=flat-square)](https://pypi.org/project/jikanpy-v4/)
[![Documentation](https://readthedocs.org/projects/jikanpy/badge/?version=latest&style=flat-square)](https://jikanpy.readthedocs.io/en/latest/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/ambv/black)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

JikanPy is a Python wrapper for [Jikan](https://github.com/jikan-me/jikan),
providing bindings for all API functionality, and supports Python 3.6+. Because
it is intended to be pretty much identical, please consult [Jikan's
documentation](https://docs.api.jikan.moe/) for thornier details on how it is
meant to be used. Perhaps most importantly, JikanPy does not make any attempts
to rate limit itself, so use it as responsibly as you would use the API
primitively and remember that Jikan API has limitations, check out
[this section](https://docs.api.jikan.moe/#section/Information/Rate-Limiting)
of documentation in order to see to what extent the API is limited or throttled.

You can use either Jikan or AioJikan depending on whether you want a synchronous
wrapper class or an asynchronous wrapper class respectively. More usage examples
are below.

In addition to the typical response from the Jikan API, each response contains
two additional fields:

- `jikan_url`: The URL that was requested; for example: `https://api.jikan.moe/v4/anime/1`.
- `headers`: The response headers from Jikan, detailed [here](https://docs.api.jikan.moe/#section/Information/Caching).

## Installation
You can install the package from PyPI using pip:

```shell
$ pip install jikanpy-v4
```

If you have previously installed the old version of jikanpy, then make sure to uninstall the old version first:

```shell
$ pip uninstall jikanpy
$ pip install --no-cache-dir jikanpy-v4
```

You can also install this package directly from the source:
```shell
$ git clone https://github.com/abhinavk99/jikanpy.git 
$ cd jikanpy
$ python setup.py install
```

*Note*: This package is different from `jikanpy` on PyPI, which is the old Jikan v3 compatible version of [jikanpy](https://github.com/abhinavk99/jikanpy/tree/jikanpy_v3).

## Usage Examples

Below are some basic examples of how to use Jikan and AioJikan. Please read the
[documentation below](#documentation) to see all the methods and more examples.

### Usage Examples with Jikan

```python
from jikanpy import Jikan
jikan = Jikan()

mushishi = jikan.anime(457)
mushishi_with_eps = jikan.anime(457, extension='episodes')

search_result = jikan.search('anime', 'Mushishi', page=2)

winter_2018_anime = jikan.seasons(year=2018, season='winter')

current_season = jikan.seasons(extension='now')
```

### Async Usage Examples with AioJikan

```python
import asyncio
from jikanpy import AioJikan

async def main():
    async with AioJikan() as aio_jikan:
        mushishi = await aio_jikan.anime(457)
        fma = await aio_jikan.manga(25)
        ginko = await aio_jikan.character(425)
        kana_hanazawa = await aio_jikan.person(185)
        naruto = await aio_jikan.search(search_type='anime', query='naruto')

    # You can also construct AioJikan like below, but make sure to close the object
    aio_jikan_2 = AioJikan()
    mushishi = await aio_jikan.anime(457)
    await aio_jikan_2.close()

asyncio.run(main())
```

## Documentation

Check out the documentation [here](https://jikanpy.readthedocs.io).

## Overriding default settings in Jikan and AioJikan with constructor arguments

If you're running an instance of [jikan-rest](https://github.com/jikan-me/jikan-rest)
on your system, and want to use that instead of [api.jikan.moe](https://jikan.moe/),
you can pass that to Jikan:

```python
from jikanpy import Jikan
jikan = Jikan(selected_base='http://localhost:8000/v4')
```

If you want to use your own Requests session, you can do that too.

```python
import requests
from jikanpy import Jikan

session = requests.Session()
# Set custom persistent headers that will be used with all HTTP requests with your session
session.headers.update({'x-test': 'true'})

jikan = Jikan(session=session)
```

You can use any or all of these constructor arguments when creating an instance
of Jikan.

AioJikan also has `selected_base` and `session` (although AioJikan uses AioHTTP
session, not Requests).

```python
import aiohttp
import asyncio

from jikanpy import AioJikan

async def main():
    # Construct AioJikan with own base URL and custom AioHTTP session with custom persistent headers
    session = aiohttp.ClientSession(headers={'x-test': 'true'})
    aio_jikan = AioJikan(selected_base='http://localhost:8000/v4', session=session)
    await session.close()

asyncio.run(main())
```

## Testing

```shell
# In root of repository
$ pytest -m pytest tests/
# Optionally, you can run a single test:
$ pytest -m pytest tests/test_jikan.py::test_anime_episodes_success
```
# Changelog for Jikanpy_v4

## [1.0.0] - 2022-12-28

### Added

- Initial support for v4 of the Jikan API

### Changed

- Package name changed from `jikanpy` to `jikanpy_v4`

### Removed

- Removed suppport for Jikan API <= v3. See [here](https://github.com/abhinavk99/jikanpy/tree/jikanpy_v3/) for old package.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/abhinavk99/jikanpy",
    "name": "jikanpy-v4",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "jikan,jikanpy,api,myanimelist",
    "author": "Chris Peterson",
    "author_email": "chris.peterson444@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/42/ce99fd8bd23b58fef576e029b1127a2e12e502e19cd42ab7ce4fe6b5c20e/jikanpy_v4-1.0.2.tar.gz",
    "platform": null,
    "description": "# JikanPy\n\n[![Travis (.com)](https://img.shields.io/travis/com/abhinavk99/jikanpy?style=flat-square)](https://travis-ci.com/abhinavk99/jikanpy)\n[![Codecov](https://img.shields.io/codecov/c/github/abhinavk99/jikanpy.svg?style=flat-square)](https://codecov.io/gh/abhinavk99/jikanpy/)\n[![pypi Version](https://img.shields.io/pypi/v/jikanpy-v4.svg?style=flat-square)](https://pypi.org/project/jikanpy-v4/)\n[![PyPi downloads](https://img.shields.io/pypi/dm/jikanpy-v4?style=flat-square)](https://pypi.org/project/jikanpy-v4/)\n[![Documentation](https://readthedocs.org/projects/jikanpy/badge/?version=latest&style=flat-square)](https://jikanpy.readthedocs.io/en/latest/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/ambv/black)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\nJikanPy is a Python wrapper for [Jikan](https://github.com/jikan-me/jikan),\nproviding bindings for all API functionality, and supports Python 3.6+. Because\nit is intended to be pretty much identical, please consult [Jikan's\ndocumentation](https://docs.api.jikan.moe/) for thornier details on how it is\nmeant to be used. Perhaps most importantly, JikanPy does not make any attempts\nto rate limit itself, so use it as responsibly as you would use the API\nprimitively and remember that Jikan API has limitations, check out\n[this section](https://docs.api.jikan.moe/#section/Information/Rate-Limiting)\nof documentation in order to see to what extent the API is limited or throttled.\n\nYou can use either Jikan or AioJikan depending on whether you want a synchronous\nwrapper class or an asynchronous wrapper class respectively. More usage examples\nare below.\n\nIn addition to the typical response from the Jikan API, each response contains\ntwo additional fields:\n\n- `jikan_url`: The URL that was requested; for example: `https://api.jikan.moe/v4/anime/1`.\n- `headers`: The response headers from Jikan, detailed [here](https://docs.api.jikan.moe/#section/Information/Caching).\n\n## Installation\nYou can install the package from PyPI using pip:\n\n```shell\n$ pip install jikanpy-v4\n```\n\nIf you have previously installed the old version of jikanpy, then make sure to uninstall the old version first:\n\n```shell\n$ pip uninstall jikanpy\n$ pip install --no-cache-dir jikanpy-v4\n```\n\nYou can also install this package directly from the source:\n```shell\n$ git clone https://github.com/abhinavk99/jikanpy.git \n$ cd jikanpy\n$ python setup.py install\n```\n\n*Note*: This package is different from `jikanpy` on PyPI, which is the old Jikan v3 compatible version of [jikanpy](https://github.com/abhinavk99/jikanpy/tree/jikanpy_v3).\n\n## Usage Examples\n\nBelow are some basic examples of how to use Jikan and AioJikan. Please read the\n[documentation below](#documentation) to see all the methods and more examples.\n\n### Usage Examples with Jikan\n\n```python\nfrom jikanpy import Jikan\njikan = Jikan()\n\nmushishi = jikan.anime(457)\nmushishi_with_eps = jikan.anime(457, extension='episodes')\n\nsearch_result = jikan.search('anime', 'Mushishi', page=2)\n\nwinter_2018_anime = jikan.seasons(year=2018, season='winter')\n\ncurrent_season = jikan.seasons(extension='now')\n```\n\n### Async Usage Examples with AioJikan\n\n```python\nimport asyncio\nfrom jikanpy import AioJikan\n\nasync def main():\n    async with AioJikan() as aio_jikan:\n        mushishi = await aio_jikan.anime(457)\n        fma = await aio_jikan.manga(25)\n        ginko = await aio_jikan.character(425)\n        kana_hanazawa = await aio_jikan.person(185)\n        naruto = await aio_jikan.search(search_type='anime', query='naruto')\n\n    # You can also construct AioJikan like below, but make sure to close the object\n    aio_jikan_2 = AioJikan()\n    mushishi = await aio_jikan.anime(457)\n    await aio_jikan_2.close()\n\nasyncio.run(main())\n```\n\n## Documentation\n\nCheck out the documentation [here](https://jikanpy.readthedocs.io).\n\n## Overriding default settings in Jikan and AioJikan with constructor arguments\n\nIf you're running an instance of [jikan-rest](https://github.com/jikan-me/jikan-rest)\non your system, and want to use that instead of [api.jikan.moe](https://jikan.moe/),\nyou can pass that to Jikan:\n\n```python\nfrom jikanpy import Jikan\njikan = Jikan(selected_base='http://localhost:8000/v4')\n```\n\nIf you want to use your own Requests session, you can do that too.\n\n```python\nimport requests\nfrom jikanpy import Jikan\n\nsession = requests.Session()\n# Set custom persistent headers that will be used with all HTTP requests with your session\nsession.headers.update({'x-test': 'true'})\n\njikan = Jikan(session=session)\n```\n\nYou can use any or all of these constructor arguments when creating an instance\nof Jikan.\n\nAioJikan also has `selected_base` and `session` (although AioJikan uses AioHTTP\nsession, not Requests).\n\n```python\nimport aiohttp\nimport asyncio\n\nfrom jikanpy import AioJikan\n\nasync def main():\n    # Construct AioJikan with own base URL and custom AioHTTP session with custom persistent headers\n    session = aiohttp.ClientSession(headers={'x-test': 'true'})\n    aio_jikan = AioJikan(selected_base='http://localhost:8000/v4', session=session)\n    await session.close()\n\nasyncio.run(main())\n```\n\n## Testing\n\n```shell\n# In root of repository\n$ pytest -m pytest tests/\n# Optionally, you can run a single test:\n$ pytest -m pytest tests/test_jikan.py::test_anime_episodes_success\n```\n# Changelog for Jikanpy_v4\n\n## [1.0.0] - 2022-12-28\n\n### Added\n\n- Initial support for v4 of the Jikan API\n\n### Changed\n\n- Package name changed from `jikanpy` to `jikanpy_v4`\n\n### Removed\n\n- Removed suppport for Jikan API <= v3. See [here](https://github.com/abhinavk99/jikanpy/tree/jikanpy_v3/) for old package.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for the Jikan API",
    "version": "1.0.2",
    "split_keywords": [
        "jikan",
        "jikanpy",
        "api",
        "myanimelist"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b4c7f622ef87ed66392c2728ff2e8a0605d0adefddc0570d9430ed99f4a705bf",
                "md5": "6773aa6ca4c646b574da8d72fea19eec",
                "sha256": "7091f3f0cd3ee47c65e4635e726bff2c1283dfa64015b4e235d08197feb43e7b"
            },
            "downloads": -1,
            "filename": "jikanpy_v4-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6773aa6ca4c646b574da8d72fea19eec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 15120,
            "upload_time": "2023-04-02T21:30:59",
            "upload_time_iso_8601": "2023-04-02T21:30:59.728002Z",
            "url": "https://files.pythonhosted.org/packages/b4/c7/f622ef87ed66392c2728ff2e8a0605d0adefddc0570d9430ed99f4a705bf/jikanpy_v4-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d42ce99fd8bd23b58fef576e029b1127a2e12e502e19cd42ab7ce4fe6b5c20e",
                "md5": "f38edabd495d1554e6225135289d4547",
                "sha256": "f8b7c598773787a29c15a4330ef44f1d879950941425497b00b5e82fec9e4405"
            },
            "downloads": -1,
            "filename": "jikanpy_v4-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f38edabd495d1554e6225135289d4547",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13155,
            "upload_time": "2023-04-02T21:31:01",
            "upload_time_iso_8601": "2023-04-02T21:31:01.471913Z",
            "url": "https://files.pythonhosted.org/packages/8d/42/ce99fd8bd23b58fef576e029b1127a2e12e502e19cd42ab7ce4fe6b5c20e/jikanpy_v4-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-02 21:31:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "abhinavk99",
    "github_project": "jikanpy",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "jikanpy-v4"
}
        
Elapsed time: 0.05292s