Python Request Push Notification

I am new at ionic…
I develop a simple android application and a independent Python script that connects to database and in some cases sends a http post for push notifications. I am getting the 400 Bad Request error.
Can you please help me?
app_id = '732364850578 ' private_key = 'AIzaSyDQvNyeYsVrQEza28WLvpkrVXaUywaIaBA' device_tokens = ['eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIyMzUwYTMyZC1jYjYwLTRkN2QtOGViZS1hMmRkOTY0NTAxZDEifQ.iWEMMg4kKdvuVd5fmBL0XeMwOHPn8GnQUKPee2efuvE'] url = "https://push.ionic.io/api/v1/push" one = str('%s:' %private_key).replace('\n','') b64 = base64.encodestring(one.encode()) #b64 = base64.encodestring(private_key) auth = "Bearer %s" % b64 push_dict = {} notification_dict = {} push_dict["tokens"] = device_tokens notification_dict["alert"] = "Hello World!" push_dict["notification"] = notification_dict push1 = json.dumps(push_dict) #req = request.Request(url, data=push_dict) req = request.Request(url, data=push1.encode()) req.add_header("Content-type", "application/json") req.add_header("X-Ionic-Application-Id", app_id) req.add_header("Authorization", auth) try: resp = request.urlopen(req) print(resp) except Exception as e: print(e)

I am using Python 3.4.
Ca you see anything wrong ??
Thanks.