Python - Render object with transparent background
You need to enable the Transparent option that you would normally activate in the Film panel which can be found in the Render tab, if you where using the GUI.  

bpy.context.scene.render.film_transparent = True


Also make sure that the file format stores the alpha channel.

bpy.context.scene.render.image_settings.color_mode = 'RGBA'