import json, base64, requests

d={"userId": "user1","event": "Product Viewed","properties": {"distinct_id": "user1","product_id": "pr_507f1f77bcf86cd799439011","sku": "G-32","category": "Games","name": "Monopoly: 3rd Edition","brand": "Hasbro","variant": "200 pieces","price": 18.99,"quantity": 1,"token": "83af3c32b1c73c25bf7d5d420444a582"}}

s = json.dumps(d)
ed = base64.b64encode(s)
url = 'http://api.mixpanel.com/track/'
data = 'data=' + ed
r = requests.post(url, data )
