Skip to main content

A python wrapper to interact for bandori.party/bandori.ga APIs

Project description

Pydori

PyPI version fury.io

Build Status

A python wrapper to provide easier access to the bandori party and bandori database public APIs.

Contents

Info

Both bandori party and bandori database provide extensive public bang dream apis. The purpose of this package is to simplify accessing the various endpoints they provide, while providing sufficient detailed documentation. Additional helper functions and classes are used to automate manual tasks. Users are able to choose between the Bandori Party API or the Bandori Database API.

Features

  • bandori party endpoints
  • bandori database endpoints
  • OOP class design
  • Make use of the bandori party and bandori database api in one package
  • additional functions to improve productivity

Current Bandori Party Endpoints

  • Cards
  • Members
  • Events
  • Costumes
  • Items
  • Areaitems
  • Assets

Current Bandori Database Endpoints

  • Cards
  • Members
  • Current Event
  • Bands
  • Songs
  • Gachas
  • Stamp
  • Comic
  • Degrees

Installation

Use pip to install:

pip install pydori

Usage

Read this to get started on pydori:

  1. Create a bandori api instance by using the bandori_api() function. The function returns a class whose functions you can use. Bandori party api does not rely on region; Bandori database api does.
import pydori

bapi = pydori.bandori_api()  # uses all default settings

# This uses the bandori database api.
# bapi = pydori.bandori_api(region='jp/', party=False)
  1. Use the bandori api class functions to access the endpoint you want. All requests made in this wrapper are GET requests using the requests module. See the documentation for what functions to use. The basic syntax is simple: get_{endpoint}(), called on the api class. They usually return lists.
cards = bapi.get_cards()
  1. GET requests can take optional arguments id and filters. id is a list of integers corresponding to the ids of the objects you want to get. filters are search terms you want to filter by: the key is the category to filter, and the value is the actual value to filter by (ie. results will only include objects that have this value for this corresponding key).
cards = bapi.get_cards(id=[511], filters={})
  1. BandoriObjects are returned from the requests. The original json object will always be stored in BandoriObject.data but all (or most) of the terms can be accessed directly as class attributes. There can also be helper functions in these objects that speed up accessing relevant data.
cards = bapi.get_cards(id=[511])
card = cards[0]

rimi = card.get_card_member()  # returns a PMember object

print(rimi.name)
  1. See the documentation, in the models section, to understand how to work with BandoriObjects.

Examples

This example instantiates a PBandoriApi object, gets a card by ID, and displays the card's name.

import pydori

b = pydori.bandori_api()
result = b.get_cards(id=[511])
card = result[0]

print(card.name)

Here we get the current event and display the start and end times:

from pydori import bandori_api

b = bandori_api()
current = b.get_current_event()

print(current.get_start_date())
print(current.get_end_date())

Pydori accepts filters for the objects, as a dictionary. This example shows how to get all songs by the band "Roselia".

import pydori

b = pydori.bandori_api(region='en/', party=False)
roselia_songs = b.get_songs(id=[], filters={'bandName' : 'Roselia'})

Documentation

The documentation is on the github wiki page.

Contributing

See contributing.

Alternatives

There are a couple of node packages that serve the same purpose, most notably node-dori. If you're more familiar with javascript you could go search for those. This seems to be the only port in python so far, though.

License

PyPI license

This project is licensed under the MIT license.

Credits

API provided by bandori.party and bandori database.

I do not own any logos, images, or assets of the BanG Dream! Franchise, they are the property and trademark of Bushiroad.

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

pydori-0.5.2.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydori-0.5.2-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file pydori-0.5.2.tar.gz.

File metadata

  • Download URL: pydori-0.5.2.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for pydori-0.5.2.tar.gz
Algorithm Hash digest
SHA256 83de4997b62964539dc39e2260435f475faec3c642d517eaa04e7d520ff6147f
MD5 33f5c5f25d3152de08f29bb40f77c61c
BLAKE2b-256 f1465a020787716881318c59b56703aac3b9982853dee5962d48c69aa3fc5bd3

See more details on using hashes here.

File details

Details for the file pydori-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: pydori-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for pydori-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 927a6306d2e41cd98ed2158215a3f47c3ad04859bac6ae14c59dc5d61432d4f5
MD5 42298df800e332a57fa99014b5f8d86d
BLAKE2b-256 94c40ab77a38c2c2aa1ceffc0fa9dd2f899f240c23901598be070d74a8b824df

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