Package: pinballmap
Pinball Map API ClientPython client forPinball Map API.Special thanks toLogan Arcadein Chicago, IL for supporting development of this project.Current version: 0.3.8Source on GitHubpinballmap at Python Package Index (PyPI)Documentation atRead the DocsInstallation$pipinstallpinballmapQuick Start>>>frompinballmapimportPinballMapClient>>>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 UsageLimited functionality at this point, but it does a few things.>>>pinballmap--helpusage:pinballmap[-h][-lLOCATION_ID][-rREGION_NAME][-i][-tAUTHENTICATION_TOKEN][-eUSER_EMAIL][-pUSER_PASSWORD]{search,machine_id,machine_ipdb,loc_machines,get_token}[value[value...]]InteractwiththePinballMapAPIfromthecommandline.positionalarguments:{search,machine_id,machine_ipdb,loc_machines,get_token}search:findsmachinedatabyname;machine_id:findsmachinematchingid;machine_ipdb:findsmachinebyIPDBid;loc_machines:listmachinesatalocationget_token:getanauthtokenforemailandpasswordvalueoptionalarguments:-h,--helpshowthishelpmessageandexit-lLOCATION_ID,--locationLOCATION_ID-rREGION_NAME,--regionREGION_NAMEregionname(e.g.,chicago)-i,--id-onlyreturnonlymachineidsforquery-tAUTHENTICATION_TOKEN,--tokenAUTHENTICATION_TOKENAPIauthenticationtoken(neededforallwriteoperations)-eUSER_EMAIL,--emailUSER_EMAILAPIUseremailaddress(requiredforallwriteoperations)-pUSER_PASSWORD,--passwwordUSER_PASSWORDAPIUserpassword(requiredifyouarenotprovidingatokenwith-t/--token)Happyflipping!Thisispython-pinballmapv0.2.2,supportingPinballMapAPIv1.0>>>pinballmapsearch'Game of Thrones (LE)'idnamemanufactureryearipdb_id----------------------------------------------------------2442GameofThrones(LE)Stern20152441GameofThrones(Pro)Stern20152527GameofThrones(Premium)Stern2015760TheBallyGameShowBally1990985>>>pinballmap--location4495loc_machinesidnamemanufactureryearipdb_id---------------------------------------------------------------------------1296AC/DC(Premium)Stern201257752832AttackFromMars(Remake)ChicagoGaming20172728Batman66(LE)Stern201663553022Deadpool(Pro)Stern2018738Dr.DudeBally19907372442GameofThrones(LE)Stern201563092571Ghostbusters(LE)Stern201663342875GuardiansoftheGalaxy(Pro)Stern201764742924IronMaiden:LegacyoftheBeast(Premium)Stern2018695JunkYardWilliams199640142353KissStern201562652306MedievalMadness(Remake)ChicagoGaming201562631606Metallica(Premium)Stern20136030641MonsterBashWilliams19984441723PIN-BOTWilliams19861796677Radical!Bally199019041276ShaqAttaqGottlieb199528742565Spider-Man(VaultEdition)Stern20166328684StarTrek:TheNextGenerationWilliams19932357694StarWarsDataEast199223582844StarWars(Premium)Stern201764291118TRON:LegacyStern20115682779TaxiWilliams19882505686Terminator2:JudgmentDayWilliams19912524687TheAddamsFamilyBally1992202203TheWalkingDead(Pro)Stern201461552866TotalNuclearAnnihilationSpooky20176444689WhiteWaterWilliams199327682277WrestlemaniaStern20156215>>>pinballmap--location4495--id-onlyloc_machines1296,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>>>pinballmapmachine_id2571idnamemanufactureryearipdb_id--------------------------------------------------2571Ghostbusters(LE)Stern20166334Example Djangosettings.pyNOTE: Django settings, if present, will take precedence over arguments to PinballMapClient(…)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 commandCreate yourapp/management/commands/update_pinball_map.py and use this as a starting point:fromdjango.core.management.baseimportBaseCommand,CommandErrorfrompinballmapimportPinballMapClientfromyourapp.somewhereimportget_current_game_listclassCommand(BaseCommand):help='Update the Pinball Map API. Adds/removes machines from our location.'defhandle(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_idforgingames])self.stdout.write(self.style.SUCCESS("Pinball Map updated."))exceptExceptionaserr:self.stderr.write(self.style.ERROR("Could not update pinball map because:{}".format(err)))Change Log0.3.6fixed a bug where code expected the wrong status codechanged from usingrequirements.txtto Poetry for package managementdid a bit of code reorganization0.3.4hopefully fix docsfix error from bumpversion0.3.3requires Python 3.6CLI catches authentication errors more cleanlymostly code cleanupshelp outputs version # of python-pinballmap and Pinball Map API version supportedall python code is now formatted usingblack0.2.0breaking change: PinballMapClient now takes keyword arguments, old ordered argument syntax will no longer worknow supports authentication tokens, signup process, getting auth detailsnow uses https by defaultfix dry-run bug0.1.2initial releaseRoadmapupdate command line interface to support signup and getting auth detailseventually support all API actions, such as scores, machine conditions, etc.