Can you add a light source in blender using python

Answer is Yes!

Look at the recent Python API.

The example below creates a new Lamp object and puts it at the default location (5, 5, 5) in the current scene:

(Blender 2.63)

The script should look like this:

import bpy

scene = bpy.context.scene

# Create new lamp datablock
lamp_data ="New Lamp", type='POINT')

# Create new object with our lamp datablock
lamp_object ="New Lamp", object_data=lamp_data)

# Link lamp object to the scene so it'll appear in this scene

# Place lamp to a specified location
lamp_object.location = (5.0, 5.0, 5.0)

# And finally select it make active = True = lamp_object

Blender 2.80 broke the old API, most steps changed. Updated code below.

import bpy

# create light datablock, set attributes
light_data ="light_2.80", type='POINT') = 30

# create new object with our light datablock
light_object ="light_2.80", object_data=light_data)

# link light object

# make it active = light_object

#change location
light_object.location = (5, 5, 5)

# update scene, if needed
dg = bpy.context.evaluated_depsgraph_get()