Name | pinballmap JSON |
Version |
0.4.6
JSON |
| download |
home_page | None |
Summary | Python client for the Pinball Map API |
upload_time | 2024-07-30 23:07:11 |
maintainer | None |
docs_url | None |
author | Duna Csandl |
requires_python | <4.0.0,>=3.11 |
license | MIT |
keywords |
pinball
map
api
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Pinball Map API Client
======================
Python client for `Pinball Map API`_.
Special thanks to `Logan Arcade`_ in Chicago, IL for supporting development of this project.
.. _Pinball Map API: http://pinballmap.com/api/v1/docs
.. _Logan Arcade: https://loganarcade.com/
Current version: 0.4.6
`Source on GitHub <https://github.com/eyesee1/python-pinballmap>`_
`pinballmap at Python Package Index (PyPI) <https://pypi.python.org/pypi/pinballmap/>`_
Documentation at `Read the Docs <https://python-pinballmap.readthedocs.io/en/latest/>`_
Installation
------------
.. code:: bash
$ pip install pinballmap
Quick Start
-----------
.. code:: python
>>> from pinballmap import PinballMapClient
>>> c = PinballMapClient(location_id=0, region_name="chicago", authentication_token="...", user_email="email@example.com")
# Sync your list of machines by providing a complete list of current Pinball Map machine_ids.
# e.g.:
>>> c.update_map([1423, 22, 33, 44, 423, 55])
# look up games by name, results sorted by match quality:
>>> c.machine_by_name("Game of Thrones (LE)")
({'created_at': '2015-10-22T18:55:02.702Z',
'id': 2442,
'ipdb_id': None,
'ipdb_link': '',
'is_active': None,
'machine_group_id': 22,
'manufacturer': 'Stern',
'name': 'Game of Thrones (LE)',
'updated_at': '2015-10-22T18:55:02.702Z',
'year': 2015}, ...)
Command Line Usage
------------------
Limited functionality at this point, but it does a few things.
.. code:: bash
>>> pinballmap --help
usage: pinballmap [-h] [-l LOCATION_ID] [-r REGION_NAME] [-i]
[-t AUTHENTICATION_TOKEN] [-e USER_EMAIL] [-p USER_PASSWORD]
{search,machine_id,machine_ipdb,loc_machines,get_token}
[value [value ...]]
Interact with the Pinball Map API from the command line.
positional arguments:
{search,machine_id,machine_ipdb,loc_machines,get_token}
search: finds machine data by name; machine_id: finds
machine matching id; machine_ipdb: finds machine by
IPDB id; loc_machines: list machines at a location
get_token: get an auth token for email and password
value
optional arguments:
-h, --help show this help message and exit
-l LOCATION_ID, --location LOCATION_ID
-r REGION_NAME, --region REGION_NAME
region name (e.g., chicago)
-i, --id-only return only machine ids for query
-t AUTHENTICATION_TOKEN, --token AUTHENTICATION_TOKEN
API authentication token (needed for all write
operations)
-e USER_EMAIL, --email USER_EMAIL
API User email address (required for all write
operations)
-p USER_PASSWORD, --passwword USER_PASSWORD
API User password (required if you are not providing a
token with -t/--token)
Happy flipping! This is python-pinballmap v0.2.2, supporting Pinball Map API
v1.0
>>> pinballmap search 'Game of Thrones (LE)'
id name manufacturer year ipdb_id
---- ------------------------- -------------- ------ ---------
2442 Game of Thrones (LE) Stern 2015
2441 Game of Thrones (Pro) Stern 2015
2527 Game of Thrones (Premium) Stern 2015
760 The Bally Game Show Bally 1990 985
>>> pinballmap --location 4495 loc_machines
id name manufacturer year ipdb_id
---- ------------------------------------------ -------------- ------ ---------
1296 AC/DC (Premium) Stern 2012 5775
2832 Attack From Mars (Remake) Chicago Gaming 2017
2728 Batman 66 (LE) Stern 2016 6355
3022 Deadpool (Pro) Stern 2018
738 Dr. Dude Bally 1990 737
2442 Game of Thrones (LE) Stern 2015 6309
2571 Ghostbusters (LE) Stern 2016 6334
2875 Guardians of the Galaxy (Pro) Stern 2017 6474
2924 Iron Maiden: Legacy of the Beast (Premium) Stern 2018
695 Junk Yard Williams 1996 4014
2353 Kiss Stern 2015 6265
2306 Medieval Madness (Remake) Chicago Gaming 2015 6263
1606 Metallica (Premium) Stern 2013 6030
641 Monster Bash Williams 1998 4441
723 PIN-BOT Williams 1986 1796
677 Radical! Bally 1990 1904
1276 Shaq Attaq Gottlieb 1995 2874
2565 Spider-Man (Vault Edition) Stern 2016 6328
684 Star Trek: The Next Generation Williams 1993 2357
694 Star Wars Data East 1992 2358
2844 Star Wars (Premium) Stern 2017 6429
1118 TRON: Legacy Stern 2011 5682
779 Taxi Williams 1988 2505
686 Terminator 2: Judgment Day Williams 1991 2524
687 The Addams Family Bally 1992 20
2203 The Walking Dead (Pro) Stern 2014 6155
2866 Total Nuclear Annihilation Spooky 2017 6444
689 White Water Williams 1993 2768
2277 Wrestlemania Stern 2015 6215
>>> pinballmap --location 4495 --id-only loc_machines
1296,2832,2728,3022,738,2442,2571,2875,2924,695,2353,2306,1606,641,723,677,1276,2565,684,694,2844,1118,779,686,687,2203,2866,689,2277
>>> pinballmap machine_id 2571
id name manufacturer year ipdb_id
---- ----------------- -------------- ------ ---------
2571 Ghostbusters (LE) Stern 2016 6334
Example Django ``settings.py``
------------------------------
NOTE: Django settings, if present, will take precedence over arguments to PinballMapClient(...)
.. code-block:: python
PINBALL_MAP = {
'region_name': 'chicago', # a region name to use if not specified in code
'location_id': your_location_id, # should be an int
# email and token are required for all write operations
'user_email': '...', # your pinball map account email, needed for write operations
'user_password': '...', # your pinball map password, needed for write operations (not needed with token)
'authentication_token': '...', # your pinball map api token, needed for write operations
'cache_name': 'default', # default: 'default'
'cache_key_prefix': 'pmap_', # default: 'pmap_'
}
Example Django management command
---------------------------------
Create yourapp/management/commands/update_pinball_map.py and use this as a starting point:
.. code-block:: python
from django.core.management.base import BaseCommand, CommandError
from pinballmap import PinballMapClient
from yourapp.somewhere import get_current_game_list
class Command(BaseCommand):
help = 'Update the Pinball Map API. Adds/removes machines from our location.'
def handle(self, *args, **options):
try:
games = get_current_game_list() # ← your code provides a list of current IDs
# no args needed if you used Django settings as shown above:
c = PinballMapClient()
c.update_map([g.pinball_map_id for g in games])
self.stdout.write(self.style.SUCCESS("Pinball Map updated."))
except Exception as err:
self.stderr.write(self.style.ERROR("Could not update pinball map because: {}".format(err)))
Change Log
==========
0.4.6
-----
* giving up on RTD theme for now - conflict on ReadTheDocs between Sphinx 8 and the theme
* fix build to include this README
* add ``.readthedocs.yaml`` so docs can build
* updated minimum Python version to 3.11
* updated some incorrect information
* updated dependencies
* fixed Poetry config so it can install, build, and publish properly
0.3.6
-----
* fixed a bug where code expected the wrong status code
* changed from using ``requirements.txt`` to Poetry for package management
* did a bit of code reorganization
0.3.4
-----
* hopefully fix docs
* fix error from bumpversion
0.3.3
-----
* requires Python 3.6
* CLI catches authentication errors more cleanly
* mostly code cleanups
* help outputs version # of python-pinballmap and Pinball Map API version supported
* all python code is now formatted using `black`_
.. _black: https://black.readthedocs.io/en/stable/
0.2.0
-----
* breaking change: PinballMapClient now takes keyword arguments, old ordered argument syntax will no longer work
* now supports authentication tokens, signup process, getting auth details
* now uses https by default
* fix dry-run bug
0.1.2
-----
* initial release
Roadmap
=======
* update command line interface to support signup and getting auth details
* eventually support all API actions, such as scores, machine conditions, etc.
Raw data
{
"_id": null,
"home_page": null,
"name": "pinballmap",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.11",
"maintainer_email": null,
"keywords": "pinball, map, API",
"author": "Duna Csandl",
"author_email": "marinas.bobble-05@icloud.com",
"download_url": "https://files.pythonhosted.org/packages/22/29/5ab4bf847c8f17fc2100d30408930853f988a22fbbcdf2508ca6267666ec/pinballmap-0.4.6.tar.gz",
"platform": null,
"description": "Pinball Map API Client\n======================\n\nPython client for `Pinball Map API`_.\n\nSpecial thanks to `Logan Arcade`_ in Chicago, IL for supporting development of this project.\n\n.. _Pinball Map API: http://pinballmap.com/api/v1/docs\n.. _Logan Arcade: https://loganarcade.com/\n\nCurrent version: 0.4.6\n\n`Source on GitHub <https://github.com/eyesee1/python-pinballmap>`_\n\n`pinballmap at Python Package Index (PyPI) <https://pypi.python.org/pypi/pinballmap/>`_\n\nDocumentation at `Read the Docs <https://python-pinballmap.readthedocs.io/en/latest/>`_\n\nInstallation\n------------\n\n.. code:: bash\n\n $ pip install pinballmap\n\n\nQuick Start\n-----------\n\n.. code:: python\n\n >>> from pinballmap import PinballMapClient\n\n >>> c = PinballMapClient(location_id=0, region_name=\"chicago\", authentication_token=\"...\", user_email=\"email@example.com\")\n\n # Sync your list of machines by providing a complete list of current Pinball Map machine_ids.\n # e.g.:\n >>> c.update_map([1423, 22, 33, 44, 423, 55])\n\n # look up games by name, results sorted by match quality:\n >>> c.machine_by_name(\"Game of Thrones (LE)\")\n ({'created_at': '2015-10-22T18:55:02.702Z',\n 'id': 2442,\n 'ipdb_id': None,\n 'ipdb_link': '',\n 'is_active': None,\n 'machine_group_id': 22,\n 'manufacturer': 'Stern',\n 'name': 'Game of Thrones (LE)',\n 'updated_at': '2015-10-22T18:55:02.702Z',\n 'year': 2015}, ...)\n\n\nCommand Line Usage\n------------------\n\nLimited functionality at this point, but it does a few things.\n\n.. code:: bash\n\n >>> pinballmap --help\n\n usage: pinballmap [-h] [-l LOCATION_ID] [-r REGION_NAME] [-i]\n [-t AUTHENTICATION_TOKEN] [-e USER_EMAIL] [-p USER_PASSWORD]\n {search,machine_id,machine_ipdb,loc_machines,get_token}\n [value [value ...]]\n\n Interact with the Pinball Map API from the command line.\n\n positional arguments:\n {search,machine_id,machine_ipdb,loc_machines,get_token}\n search: finds machine data by name; machine_id: finds\n machine matching id; machine_ipdb: finds machine by\n IPDB id; loc_machines: list machines at a location\n get_token: get an auth token for email and password\n value\n\n optional arguments:\n -h, --help show this help message and exit\n -l LOCATION_ID, --location LOCATION_ID\n -r REGION_NAME, --region REGION_NAME\n region name (e.g., chicago)\n -i, --id-only return only machine ids for query\n -t AUTHENTICATION_TOKEN, --token AUTHENTICATION_TOKEN\n API authentication token (needed for all write\n operations)\n -e USER_EMAIL, --email USER_EMAIL\n API User email address (required for all write\n operations)\n -p USER_PASSWORD, --passwword USER_PASSWORD\n API User password (required if you are not providing a\n token with -t/--token)\n\n Happy flipping! This is python-pinballmap v0.2.2, supporting Pinball Map API\n v1.0\n\n\n\n\n >>> pinballmap search 'Game of Thrones (LE)'\n id name manufacturer year ipdb_id\n ---- ------------------------- -------------- ------ ---------\n 2442 Game of Thrones (LE) Stern 2015\n 2441 Game of Thrones (Pro) Stern 2015\n 2527 Game of Thrones (Premium) Stern 2015\n 760 The Bally Game Show Bally 1990 985\n\n\n >>> pinballmap --location 4495 loc_machines\n id name manufacturer year ipdb_id\n ---- ------------------------------------------ -------------- ------ ---------\n 1296 AC/DC (Premium) Stern 2012 5775\n 2832 Attack From Mars (Remake) Chicago Gaming 2017\n 2728 Batman 66 (LE) Stern 2016 6355\n 3022 Deadpool (Pro) Stern 2018\n 738 Dr. Dude Bally 1990 737\n 2442 Game of Thrones (LE) Stern 2015 6309\n 2571 Ghostbusters (LE) Stern 2016 6334\n 2875 Guardians of the Galaxy (Pro) Stern 2017 6474\n 2924 Iron Maiden: Legacy of the Beast (Premium) Stern 2018\n 695 Junk Yard Williams 1996 4014\n 2353 Kiss Stern 2015 6265\n 2306 Medieval Madness (Remake) Chicago Gaming 2015 6263\n 1606 Metallica (Premium) Stern 2013 6030\n 641 Monster Bash Williams 1998 4441\n 723 PIN-BOT Williams 1986 1796\n 677 Radical! Bally 1990 1904\n 1276 Shaq Attaq Gottlieb 1995 2874\n 2565 Spider-Man (Vault Edition) Stern 2016 6328\n 684 Star Trek: The Next Generation Williams 1993 2357\n 694 Star Wars Data East 1992 2358\n 2844 Star Wars (Premium) Stern 2017 6429\n 1118 TRON: Legacy Stern 2011 5682\n 779 Taxi Williams 1988 2505\n 686 Terminator 2: Judgment Day Williams 1991 2524\n 687 The Addams Family Bally 1992 20\n 2203 The Walking Dead (Pro) Stern 2014 6155\n 2866 Total Nuclear Annihilation Spooky 2017 6444\n 689 White Water Williams 1993 2768\n 2277 Wrestlemania Stern 2015 6215\n\n\n >>> pinballmap --location 4495 --id-only loc_machines\n 1296,2832,2728,3022,738,2442,2571,2875,2924,695,2353,2306,1606,641,723,677,1276,2565,684,694,2844,1118,779,686,687,2203,2866,689,2277\n\n\n\n >>> pinballmap machine_id 2571\n id name manufacturer year ipdb_id\n ---- ----------------- -------------- ------ ---------\n 2571 Ghostbusters (LE) Stern 2016 6334\n\n\nExample Django ``settings.py``\n------------------------------\n\nNOTE: Django settings, if present, will take precedence over arguments to PinballMapClient(...)\n\n.. code-block:: python\n\n PINBALL_MAP = {\n 'region_name': 'chicago', # a region name to use if not specified in code\n 'location_id': your_location_id, # should be an int\n # email and token are required for all write operations\n 'user_email': '...', # your pinball map account email, needed for write operations\n 'user_password': '...', # your pinball map password, needed for write operations (not needed with token)\n 'authentication_token': '...', # your pinball map api token, needed for write operations\n 'cache_name': 'default', # default: 'default'\n 'cache_key_prefix': 'pmap_', # default: 'pmap_'\n }\n\n\n\nExample Django management command\n---------------------------------\n\nCreate yourapp/management/commands/update_pinball_map.py and use this as a starting point:\n\n.. code-block:: python\n\n from django.core.management.base import BaseCommand, CommandError\n from pinballmap import PinballMapClient\n from yourapp.somewhere import get_current_game_list\n\n\n class Command(BaseCommand):\n help = 'Update the Pinball Map API. Adds/removes machines from our location.'\n\n def handle(self, *args, **options):\n try:\n games = get_current_game_list() # \u2190 your code provides a list of current IDs\n # no args needed if you used Django settings as shown above:\n c = PinballMapClient()\n c.update_map([g.pinball_map_id for g in games])\n self.stdout.write(self.style.SUCCESS(\"Pinball Map updated.\"))\n except Exception as err:\n self.stderr.write(self.style.ERROR(\"Could not update pinball map because: {}\".format(err)))\n\n\n\nChange Log\n==========\n\n0.4.6\n-----\n\n* giving up on RTD theme for now - conflict on ReadTheDocs between Sphinx 8 and the theme\n* fix build to include this README\n* add ``.readthedocs.yaml`` so docs can build\n* updated minimum Python version to 3.11\n* updated some incorrect information\n* updated dependencies\n* fixed Poetry config so it can install, build, and publish properly\n\n\n0.3.6\n-----\n\n* fixed a bug where code expected the wrong status code\n* changed from using ``requirements.txt`` to Poetry for package management\n* did a bit of code reorganization\n\n\n0.3.4\n-----\n* hopefully fix docs\n* fix error from bumpversion\n\n\n0.3.3\n-----\n\n* requires Python 3.6\n* CLI catches authentication errors more cleanly\n* mostly code cleanups\n* help outputs version # of python-pinballmap and Pinball Map API version supported\n* all python code is now formatted using `black`_\n\n.. _black: https://black.readthedocs.io/en/stable/\n\n\n\n0.2.0\n-----\n\n* breaking change: PinballMapClient now takes keyword arguments, old ordered argument syntax will no longer work\n* now supports authentication tokens, signup process, getting auth details\n* now uses https by default\n* fix dry-run bug\n\n\n0.1.2\n-----\n* initial release\n\n\nRoadmap\n=======\n\n* update command line interface to support signup and getting auth details\n* eventually support all API actions, such as scores, machine conditions, etc.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client for the Pinball Map API",
"version": "0.4.6",
"project_urls": null,
"split_keywords": [
"pinball",
" map",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e6897f07a046a2679441d9c42d6a21640d8a9d3e7f54942d477c59a3d30a6fb3",
"md5": "839657c6419d1f05a64fcdfcc08becca",
"sha256": "cfe8d5463f3ae741fdef26d1073bfb7491cb6c7ebd2bbb51a17e85012593c1e8"
},
"downloads": -1,
"filename": "pinballmap-0.4.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "839657c6419d1f05a64fcdfcc08becca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.11",
"size": 15180,
"upload_time": "2024-07-30T23:07:10",
"upload_time_iso_8601": "2024-07-30T23:07:10.007272Z",
"url": "https://files.pythonhosted.org/packages/e6/89/7f07a046a2679441d9c42d6a21640d8a9d3e7f54942d477c59a3d30a6fb3/pinballmap-0.4.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "22295ab4bf847c8f17fc2100d30408930853f988a22fbbcdf2508ca6267666ec",
"md5": "ec180cd1801f8d36f90fb8083128842a",
"sha256": "ca279df15199e1c34c22d4ff8885b59f7ec03fd50a41135c55dd497558053aca"
},
"downloads": -1,
"filename": "pinballmap-0.4.6.tar.gz",
"has_sig": false,
"md5_digest": "ec180cd1801f8d36f90fb8083128842a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.11",
"size": 16186,
"upload_time": "2024-07-30T23:07:11",
"upload_time_iso_8601": "2024-07-30T23:07:11.083010Z",
"url": "https://files.pythonhosted.org/packages/22/29/5ab4bf847c8f17fc2100d30408930853f988a22fbbcdf2508ca6267666ec/pinballmap-0.4.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-30 23:07:11",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pinballmap"
}