UV unwrap each face of an object via python script
Manipulating UV coordinates in python is usually done via the bmesh interface.

I include an example from barber-pole.py

def spiralUVs(mesh, xPlus):
    # add a UV layer called "spiral" and make it slanted.
    mesh.uv_textures.new("spiral")
    bm = bmesh.new()
    bm.from_mesh(mesh)

    bm.faces.ensure_lookup_table()

    uv_layer = bm.loops.layers.uv[0]

    nFaces = len(bm.faces)
    for fi in range(nFaces):
        x0 = fi*2/nFaces
        x1 = (fi+1)*2/nFaces
        bm.faces[fi].loops[0][uv_layer].uv = (x0, 0)
        bm.faces[fi].loops[1][uv_layer].uv = (x1, 0)
        bm.faces[fi].loops[2][uv_layer].uv = (xPlus+x1, 1)
        bm.faces[fi].loops[3][uv_layer].uv = (xPlus+x0, 1)
    bm.to_mesh(mesh)


Some other examples that set UV texture coordinates include


http://web.purplefrog.com/~thoth/blender/python-cookbook/expand-uv-to-fit.html
http://web.purplefrog.com/~thoth/blender/python-cookbook/uv-from-geometry-cubic.html
http://web.purplefrog.com/~thoth/blender/python-cookbook/meshFromBathymetry.html
http://web.purplefrog.com/~thoth/blender/python-cookbook/thicken-texture.html