Ionic API rest with python

Ey I wanna know how to use the python Api example for Ionic
notifications. Im newbie and I don’t understand how it works. I tried to
run the code but it shows me an error: unhashable type.

# Import libs
import urllib2
import base64
# Define relevant info
app_id = '··········'
private_key = '··················'
device_tokens = ['·························']
url = "https://push.ionic.io/api/v1/push"

# Generate authentication
b64 = base64.encodestring('%s:' % private_key).replace('\n', '')
auth = "Basic %s" % b64

# Build the JSON payload
push_dict = {}
notification_dict = {}
push_dict["tokens"] = device_tokens
notification_dict["alert"] = "Hello World!"
push_dict["notification"] = notification_dict

# Make the request
req = urllib2.Request(url, data=push_dict)
req.add_header("Content-Type", "application/json")
req.add_header("X-Ionic-Application-Id", app_id)
req.add_header("Authorization", auth)
resp = urllib2.urlopen(req)

Thanks