The following Python 2 wrapper can communicate with the Phish.net API. It was submitted by Terry Moore. You can download the phish.net API python 2 wrapper for use.
#Query Phish.net API via Python 2.71. import urllib, json, sys url='https://api.phish.net/' endpoint='api.js' apikey = '' format = 'json' apiver = '2.0' method = 'pnet.shows.setlists.latest' #Build parameters to send via GET to api.js params = urllib.urlencode({ 'api':apiver, 'method':method, 'format':format, 'apikey':apikey }) #Attempt to open a connection and get the JSON formatted data try: f = urllib.urlopen(url + endpoint + "?%s" % params) #Do this for invalid URL except IOError: print 'Error: Unable to connect. Invalid URL. ' sys.exit(1) #Get the response code rsp = f.getcode() #If the HTTP response is 200 (OK) then proceed if rsp == 200: #Read the data data = f.read() #Decode the data as JSON decoded = json.loads(data) #Print the Decoded JSON print 'DECODED: ', decoded #Print an individual JSON Record print 'GET INDIVIDUAL RECORD: ', decoded[0]['showdate'] else: #Do this if the not an HTTP response of 200 print 'Error - HTTP Response Code: ', rsp #close the connection f.close()
This should provide you the infrastructure to communicate with the phish.net API using any method.
Phish.net is a non-commercial project run by Phish fans and for Phish fans under the auspices of the all-volunteer, non-profit Mockingbird Foundation.
This project serves to compile, preserve, and protect encyclopedic information about Phish and their music.
Credits | Terms Of Use | Legal | DMCA
The Mockingbird Foundation is a non-profit organization founded by Phish fans in 1996 to generate charitable proceeds from the Phish community.
And since we're entirely volunteer – with no office, salaries, or paid staff – administrative costs are less than 2% of revenues! So far, we've distributed over $2 million to support music education for children – hundreds of grants in all 50 states, with more on the way.