An open pinball database client for Python
Project description
Python Open Pinball Database Client
This is a Python client for the Open Pinball Database API.
Installation
pip install open-pinball-db
import open_pinball_db
opdb_client = open_pinball_db.Client()
# Start using the client
Usage
Public API (no authentication required)
Get changelog
import open_pinball_db
opdb_client = open_pinball_db.Client()
opdb_client.get_changelog()
Typeahead search
Parameter | Type | Description |
---|---|---|
q | str | The search query |
include_aliases | bool | Whether to include aliases in the search. Default is True |
include_groups | bool | Whether to include groups in the search. Default is False |
import open_pinball_db
opdb_client = open_pinball_db.Client()
opdb_client.typeahead_search('The Addams Family')
Private API (authentication required)
Get your free api key at Open Pinball Database.
Search Machines
Parameter | Type | Description |
---|---|---|
q | str | The search query |
require_opdb | bool | Limit results to machines with OPDB ids. Defaults to True |
include_aliases | bool | Whether to include aliases in the search. Default is True |
include_groups | bool | Whether to include groups in the search. Default is False |
include_grouping_entries | bool | Whether to include grouping entries in the search. Default is False |
import open_pinball_db
opdb_client = open_pinball_db.Client(api_key="your_secret_api_key")
opdb_client.search('The Addams Family')
Get Machine By OPDB ID
Parameter | Type | Description |
---|---|---|
opdb_id | str | The IPDB ID of the machine |
import open_pinball_db
opdb_client = open_pinball_db.Client(api_key="your_secret_api_key")
opdb_client.get_machine("OPDB-ID")
Get Machine By IPDB ID
Parameter | Type | Description |
---|---|---|
ipdb_id | int | The IPDB ID of the machine |
import open_pinball_db
opdb_client = open_pinball_db.Client(api_key="your_secret_api_key")
opdb_client.get_machine_by_ipdb_id(1234)
Export Machines and Aliases
Export all machines and aliases into a big json document. According to the OPDB API docs this endpoint is rate limited to once every hour.
import open_pinball_db
opdb_client = open_pinball_db.Client(api_key="your_secret_api_key")
opdb_client.export_machines_and_aliases()
Export Machines Groups
Export all machine groups as a single JSON document.
import open_pinball_db
opdb_client = open_pinball_db.Client(api_key="your_secret_api_key")
opdb_client.export_machine_groups()
Handling Exceptions
The client can raise the following exceptions:
Exception | Description |
---|---|
OpdbError | Base exception class for all exceptions |
OpdbMissingApiKey | Raised when trying to access private parts of the OPDB API without an API key |
OpdbHttpError | Raised upon http errors. Contains status code and message. |
OpdbTimeoutError | Raised upon timeout errors. |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
open_pinball_db-0.1.0.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file open_pinball_db-0.1.0.tar.gz
.
File metadata
- Download URL: open_pinball_db-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.7 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9decb97bd5b77ef95e9319520aeb9c28d899a47e6007f22cf19e795c4eb9c472 |
|
MD5 | 759ee69423486a45aaebf3268e29646d |
|
BLAKE2b-256 | c3928377c5c5be69e2efaac67256d06b2b7c6e601938c1ae4b7b996a036f7d8e |
File details
Details for the file open_pinball_db-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: open_pinball_db-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.7 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7d9cb56918da56a19b01c0efea0c8a99771c344185b79a47c06e3e2e55b17b4 |
|
MD5 | fa1a6544f15a1ca2d312b7b1d33f9dce |
|
BLAKE2b-256 | c3e7720673685b52d71ff2b5780317a25ebf13ea59654dd88ff90c4749a252f9 |