Python Wrapper For The API

While browsing the API documentation I noticed that it was missing a Python wrapper.  So I said to my self, this sound like a quick and fun project to test out my Python <cough> skills </cough>.

Just update the method variable to which ever method you are using and add the remaining parameters if necessary.  Here is more docuemtation on the API and where to apply for one.

While you are at it check out Adam Scheinberg and my official Phish.Net Google Chrome Extension.

FYI, This is only been tested on Python 2.7.1.  I am pretty sure that it will not work in Python 3.

#Query API via Python 2.71.
import urllib, json, sys
apikey = 'Your API Key'
format = 'json'
apiver = '2.0'
method = 'pnet.shows.setlists.latest'
#Build parameters to send via GET to api.js
params = urllib.urlencode({
#Attempt to open a connection and get the JSON formated data
  f = urllib.urlopen(url + js + "?%s" % params)
#Do this for invalid URL
except IOError:
  print 'Error: Unable to connect. Invalid URL. '
#Get the response code
rsp = f.getcode()
#If the HTTP response is 200 (OK) then proceed
if rsp == 200:
  #Read the data
  data =
  #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']
  #Do this if the not an HTTP response of 200
  print 'Error: ',  rsp
#close the connection

I have submitted this to the administrators and if it gets the Ok then it will be uploaded here.

Update: The code has been posted on site.

Update 2: I forgot to give proper credit to Adam for his help on the Chrome Extension.

Official Google Chrome Extension

Here is the release announcement for the Official Google Chrome extension that myself and Adam Scheinberg have been working on.

We’re proud to unveil the official Google Chrome extension. Written by user Terry Moore and blessed by the tech team, this extension utilizes API goodness to deliver setlists and forum posts right into your browser.


Phish Announces Fall Tour


11.18.09 Cobo Arena, Detroit, MI
11.20.09 U.S. Bank Arena, Cincinnati, OH
11.21.09 U.S. Bank Arena, Cincinnati, OH
11.22.09 War Memorial at Oncenter , Syracuse, NY
11.24.09 Wachovia Center, Philadelphia, PA
11.25.09 Wachovia Center, Philadelphia, PA
11.27.09 Times Union Center, Albany, NY
11.28.09 Times Union Center, Albany, NY
11.29.09 Cumberland County Civic Center, Portland, ME
12.02.09 Madison Square Garden , New York, NY
12.03.09 Madison Square Garden, New York, NY
12.04.09 Madison Square Garden, New York, NY
12.05.09 John Paul Jones Arena, Charlottesville, VA

I would love to do the Detroit to Cincinnati run.  Now, if I only had the funds.  Plus this conflicts with the OSU vs Michigan game on the 21st.