How to specify Nurbs path vertices in python?
Based on your starting point script below. Added reference to spline types since bezier curve points are stored differently than nurbs curve points.

import bpy
import random


def pathPointLoc(cpath, points):

    if cpath.type in ['NURBS', 'POLY']:
        cpath.points.add(len(points)-1)
        for (index, point) in enumerate(points):
            cpath.points[index].co = point
            print(cpath.points[index].co)
        cpath.use_endpoint_u = True
    elif cpath.type in ['BEZIER']:
        cpath.bezier_points.add(len(points)-1)
        for (index, point) in enumerate(points):
            x, y, z, w = point
            cpath.bezier_points[index].co = x, y, z
            cpath.bezier_points[index].handle_left = x-1, y-1, z-1
            cpath.bezier_points[index].handle_right = x+1, y+1, z+1
            print(cpath.bezier_points[index].co)
    return

cu = bpy.data.curves.new("MyCurveData", "CURVE")
ob = bpy.data.objects.new("MyCurveObject", cu)
polyline = cu.splines.new('NURBS')  # 'POLY''BEZIER''BSPLINE''CARDINAL''NURBS'

scn = bpy.context.scene
scn.objects.link(ob)
scn.objects.active = ob

cu.dimensions = '3D'
cu.bevel_object = bpy.data.objects["BezierCircle"]
cu.taper_object = bpy.data.objects["BezierCircle"]

pts = [(0, 0, 0, 1), (0, 0, random.randint(1,4), 1), (0, 1, 1, 1), (1, 4, 1, 1)]
pathPointLoc(polyline, pts)