Skip to main content

A package to use the One-Piece API : https://api-onepiece.com/

Project description

One Pyece

Image generated with Midjourney.

PyPI - Python Version PyPI GitHub Workflow Status PyPI - License GitHub last commit

forthebadge forthebadge

Description

Python API wrapper for https://api-onepiece.com/
Thank's to this package you can simply get informations about One Piece characters, fruits, crews, etc. The datas provided by the API are in french only for the moment.
Learn more about possibilities in the Usage section.

⚠️This package is still in development and it's my very first python package, so it may not be stable.

What's New in v2.0

Multilanguage Support: One Pyece now supports multiple languages! Starting from version 2.0, you can generate an `API` object with a language parameter, making it possible to fetch data in either French or English. English is the default language if the parameter is not set. This enhancement aims to make our API more accessible and user-friendly for our international audience.

Installation

There are several solutions :

  • Use this command pip install onepyece to get it from PyPi
  • Use this command pip install git+https://github.com/icepick4/onepyece to download it from this repo.
  • Download either the .zip or the tar.gz archive from the last release and then use this command pip install <path_to_archive>

Usage

>>> import onepyece as op


>>> sanji = op.character_by_name('sanji') # You can get a character by its name
>>> sanji.size
>>> '180cm'
>>> sanji.crew['roman_name']
>>> 'Mugiwara no Ichimi'

>>> nb_fruits = op.count_fruits() # You can get the count of a specific endpoint
>>> nb_fruits.count
>>> 206
>>> nb_fruits.url
>>> 'https://api.api-onepiece.com/v2/fruits/en/count'

>>> crews = op.API('crews') # List of all the crews in dict form as you can see below
>>> crews[0]
>>> API(object={'endpoint': None, 'search_term': None, 'resource': None, 'lang': 'en', 'url': None, 'id': 1, 'name': 'The Chapeau de Paille crew', 'description': None, 'status': 'assets', 'roman_name': 'Mugiwara no Ichimi', 'total_prime': '3.161.000.100', 'number': '10', 'is_yonko': True})
>>> crews.count # You can implicitly get the count of an endpoint by getting the whole list of it.
>>> 149
>>> crews[1].name
>>> 'Le Roux crew'

# Make a search on a list already fetched
>>> roger_crew = crews.search('name', 'roger')
>>> roger_crew
>>> Total crews found for this search: 1.
>>> roger_crew[0]
{
    "endpoint": null,
    "search_term": null,
    "resource": null,
    "lang": "en",
    "url": null,
    "id": 5,
    "name": "The Pirates Roger crew",
    "description": null,
    "status": "dissolved",
    "roman_name": "Rojā Kaizoku Dan",
    "total_prime": "5.564.800.000",
    "number": "30",
    "is_yonko": true
}

To learn more about the possibilities, you can check the detailed documentation here and more examples here.

Tests

You can test the application by running python -m tests

Contributing

Pull requests are welcome. Do not hesitate to open an issue if you have any problem or suggestion.

License

This project is under the MIT License.

Author

Remi Jara
Remi Jara

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

onepyece-2.0.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

onepyece-2.0.1-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file onepyece-2.0.1.tar.gz.

File metadata

  • Download URL: onepyece-2.0.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.4

File hashes

Hashes for onepyece-2.0.1.tar.gz
Algorithm Hash digest
SHA256 1868993e55df27ba367ca05f82b20e412d7ef98ba799e88ace89f3ddd470c876
MD5 9aafbd677c855fd988621084f8fe409a
BLAKE2b-256 4c445bb9b04af8a961353c36e9d08748ee862e0f57a75c6c22f8e7db25f7d28b

See more details on using hashes here.

File details

Details for the file onepyece-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: onepyece-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.4

File hashes

Hashes for onepyece-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd0e259ace28248cfd85550ec56bf85592097b3f137950c7b8224b8a25552992
MD5 924de09d806b11d45f3f85cd50782070
BLAKE2b-256 5150be2ba3b63f6ea88fc6b0623bb07b9aff069b89eb53ead2759d0448fdae03

See more details on using hashes here.

Supported by

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