Connecting two points with a line/curve via Python script
Using API methods rather than operator.

Using methods outlined similar to those in Bezier-Spline with Python adds unwanted point .

Method to create a 2 point bezier curve object, with each end at defined global locations and the origin in the middle.  Notice the left and right handles types are set to auto resulting in a straight line.. (perhaps a poly would be simpler in this situation)

import bpy
from mathutils import Vector

def add_bezier(v0 , v1):
    v0, v1 = Vector(v0), Vector(v1)  
    o = (v1 + v0) / 2  

    curve = bpy.data.curves.new('Curve', 'CURVE')
    spline = curve.splines.new('BEZIER')
    bp0 = spline.bezier_points[0]
    bp0.co = v0 - o
    bp0.handle_left_type = bp0.handle_right_type = 'AUTO'

    spline.bezier_points.add(count=1)
    bp1 = spline.bezier_points[1]
    bp1.co = v1 - o
    bp1.handle_left_type = bp1.handle_right_type = 'AUTO'
    ob = bpy.data.objects.new('Curve', curve)
    ob.matrix_world.translation = o
    return ob


As an example of usage, select a mesh object and run  script below to add curves matching each edge.

context = bpy.context
scene = context.scene
ob = context.object
mw = ob.matrix_world
me = ob.data

for e in me.edges:
    pts = [mw * me.vertices[v].co for v in e.vertices]
    o = add_bezier(*pts)
    curve = o.data    
    curve.dimensions = '3D'
    curve.bevel_depth = 0.010
    curve.bevel_resolution = 3
    scene.objects.link(o)


Note should you wish to not use the global coordinates, could make a single axis aligned curve, and align it using the methods outlined in Align Object to Vector using python (consider using an end as origin)